Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

=+b) Is this model appropriate for this series? Explain.

Answered: 1 week ago