Quiz 2
Quiz 2
Question: Write code for circular Queue using LinkList having Enqueue, Dequeue and DisplayQueue
functions. The Enqueue function should insert an element at the end of Queue, and the dequeue function
should delete the first element in the Queue, and update the positions of the remaining entries in the
Queue. The DisplayQueue function should display the value at each position. Complete the missing code
below:
#include <iostream>
using namespace std;
struct queue
{
int data;
queue *next;
};
Page 1 out of 3
}
int Dequeue()
{
}
Page 2 out of 3
void DisplayQueue()
{
}
int main()
{
DisplayQueue();
Enqueue(3); Enqueue(6); Enqueue(9); Enqueue(12); Enqueue(15); Enqueue(18);
DisplayQueue();
Dequeue(); Dequeue();
DisplayQueue();
Enqueue(30); DisplayQueue();
return 0;
}
Page 3 out of 3