So I have made a program for schoolwork which is supposed to be a bookshop's stock program. The program ought to have Struct, Stack, Pointer, Array, and a Searching Method. My program already has a struct like this (there are more variables in my actual program)
1 2 3 4 5 6
struct BookInfo
{
int year;
string author;
string publisher;
};
My question is, is there any way I can make a stack of this struct, but with 1 book occupying 1 stack? (stack 1 consists of a BookInfo containing all the variables in it, instead of stack 1 only containing year, stack 2 contains author, etc.)
One more thing, my teacher said we can not use stack header for this project so we can understand more of the actual work behind stacks. She told us to create a 'manual' stack, so here is the example that she gave us:
It's still not clear where the stack fits in. In main you create an array to store the BookInfos what makes sense. BTW you need to pass the array to the input_book function.
Why do you input only 1 book when the array has space for 10 ?