Quote:
Originally Posted by Ooble
Are you creating the queue entirely yourself or can you use one that's been built for you?
If you're allowed to use a built-in library, try the queue class of the standard library. As you'll need five, make an array of five of them.
std::queue<queue type> q[5];
That should be all you need to create them. Obviously, you'll need to replace " queue type" with whatever type of variable you're storing in it. You can then use the push and pop methods to store and remove information. In addition, front will return the frontmost item in the queue.
|
Well, I'm using the queue.c and queue.h files, which contain the basic functions regarding queues (create, destroy, enqueue, dequeue, IsEmpty...)
So do you mean I should do smthg as:
#include <stdio.h>
#include <queue.h>
int main
{
Queue q[5];//where Queue is the abstract datatype that corresponds to queues
int i;
for(i=0;i<5;i++)
q[i]= CreateQueue(2); //queue size = 2
....
return 0;
} ??