Question: the commented are the directions source .cpp #include q.h int main(void) { Queue q(4); q.Display(); q.Enqueue(20); q.Enqueue(30); q.Enqueue(40); q.Enqueue(50); q.Display(); q.Enqueue(60); q.Display(); q.Dequeue(); q.Dequeue(); q.Display();

the commented are the directions 

source .cpp

#include \"q.h\"

int main(void) { Queue q(4); q.Display(); q.Enqueue(20); q.Enqueue(30); q.Enqueue(40); q.Enqueue(50); q.Display(); q.Enqueue(60); q.Display(); q.Dequeue(); q.Dequeue(); q.Display(); system(\"pause\"); return 0; }

q.cpp

#include \"q.h\"

template Queue::Queue(int c) { //TODO: initialize private parameters, c is the size of the dynamic array

}

template Queue::~Queue() { //TODO: delete the array }

template void Queue::Enqueue(T data) { //TODO: to insert an element at the rear of the queue return; }

template void Queue::Dequeue() { //TODO: to delete an element from the front of the queue return; }

template void Queue::Display() { int i; if (front == rear) { cout return; } for (i = front; i { cout } cout return; }

template class Queue;

q.h

#pragma once #include #include #include

using namespace std;

template class Queue { public: Queue(int c); ~Queue(); void Enqueue(T data); void Dequeue(); void Display(); private: int front, rear, capacity; T* queue; };




Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!