Question: Using C++, complete this task: Create a queue class Create a new project. You can name this whatever you like. Design a queue class using

Using C++, complete this task: Create a queue class

Create a new project. You can name this whatever you like.

Design a queue class using an array (or a vector) to store data. This class should be a template. Include the standard functions for a queue.

The constructor should include a parameter to indicate the size of the array.

The array holding the data should be an array of pointers.

The enqueue function should accept a pointer and add that pointer to the back of the queue. It doesnt need to create any memory.

The dequeue function should return a pointer. It doesnt need to delete any memory.

The peekFront function should return a pointer to the item on the front of the queue without removing it.

The length function will return an int indicating the number of items in the queue.

The empty function should empty the stack of all contents. It needs to call delete to avoid memory leaks. It doesnt need to return any value.

The queue should declare a friend function that can access the underlying array for the purposes of printing it to the screen

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 Databases Questions!