Well, if im understanding this right.
You wish to create array of structure Book.
struct Book
{
string name;
int bookID;
string dateRent;
};
Book arr[10];
This would be array of 10 elements for given structure Book in c++.
You can also create dynamic array like this
Book* arr;
arr = new Book[10];
You can access elements like this
arr[0].name;
arr[0].bookID;
arr[0].rentDate;
If you wish to create c++ structure that acts like a FIFO queue, you will have to create something like this
struct Book
{
string name;
int bookID;
string dateRent;
};
struct BookQueue {
Book arr[10];
int size = 0;
void insert(Book book) {
if (size == 10) return;
for (int i = size-1; i >= 0; i--) {
arr[i + 1] = arr[i];
}
arr[0] = book;
size++;
}
Book remove() {
if (size < 0) return arr[0]; //it should throw error here
size--;
return arr[size];
}
};
NOTE: This is bad for queue, but it is a structure queue, the simple one. For starters.