bool addBook(Book book) {
if (books == 10) //books count the number of instances
returnfalse;
bookQueue[books] = book; //books works as an index
books++;
returntrue;
}
You are giving too much responsibility to books. You need to consider the remove operation.
@ne555: When books == 10, it's pointing at the 11th index. Because this index is invalid due to the size of our array being 10 this is completely valid.
The index and count in this situation are the same thing. I've not offered a solution, but an illustration of how the objects could be built and put into a static array. The original post shows much confusion about the techniques required to start putting the final functionality together. I've offered some code that should help with this.
If I was giving a solution for a Queue, I'd use the STL queue.
To do it with the code I've provided you need 2 ints. index and size so you can wrap the index around the array without having to copy objects continuously.