Sorry if the title is misleading, as wasnt sure how to correctly name the question I have.
Im working on a 2 part assignment, where first you need to create a QUEUE template that imitates a queue (FIFO) with enqueue and dequeue. I've done this ( I believe)
And the 2nd part - creating a Human class with any data that is declared withing queue template (i.e. Queue <Human> HumanQueue; ) - This is the part Im having some trouble with. I understand the premise of it, but I cant wrap my head around how to go about implementing this.
Heres the code I have at the moment for the queue template.
Essentially Im looking for some pointers on how to create a class Human (with data such as Name, surname and age) and then using the queue template to imitate a queue where each Human is placed in it.
You create a Human object. You set the name, surname and age in that object. Then you use the queue class function enqueue.
1 2 3 4 5 6
struct Human
{
string name;
string surname;
int age;
};
1 2 3 4 5 6 7 8
Human a_human; // Create a human
a_human. name = "Mike"; // set the values in the human
a_human. surname= "Takahashi";
a_human. age= "40";
queue<Human> humanQueue; // Make a queue
humanQueue.enqueue(a_human); // Put that human in the queue.