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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started