Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Note: You will have two weeks to work on this lab Circular queue (also known as

ID: 3827453 • Letter: N

Question

Note: You will have two weeks to work on this lab Circular queue (also known as a circular buffer and circular array information: http://www.mathcsemory.edu cheung Courses /Sylla bus/S-List array-queue2.html https://en wikipedia.org/wiki Circular buffer Implement the Queue data type as a circular queue. The specification (header .h) file is as follows: const int MAX 15; template «class Itemtype class Que Type public: Que Type easiest one void MakeEmpty(): just as easy simple bool IsEmpty const; bool Is Full const; also simple void Enqueue Itemtype item push Item type Dequeue pops it off AND returns the front private: Item type que IMAX]; int rear; int front; Note that the queue can hold 1 less than the maximum number of entries. Create a driver program that enqueues values into the queue and then dequeues them and prints them to the screen. Do this twice using the following values for data: An 11 1 S

Explanation / Answer

#include <iostream>
#include <queue>
using namespace std;
int main()
{
queue< double > values; // queue with doubles
// push elements onto queue values
values.push( 13);
values.push( 40);
values.push( 31 );
values.push( 15 );
values.push( 11);
values.push( 10 );
values.push( 20);
values.push( 96);
values.push( 55);
values.push( 34);

cout << "Popping from values: ";
// pop elements from queue
while( )
{
cout << values.front() << ' '; // view front element
values.pop(); // remove element
} // end while
cout << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote