Please implement a “Queue” class in C++. In your queue structure, you will use regular C++ array ( not vectors ) to keep elements.MAX size of the queue is 10. Your class should have these attributes...


Please implement a “Queue” class in C++. In your queue structure, you will use regular C++ array (not vectors) to keep elements.MAX size of the queue is 10. Your class should have these attributes and functions:



  1. Attributes:


    1. int queue[MAX]: regular integer array with MAX elements. MAX can be defined as a static constant variable, or it can be defined as a macro.


    2. int front:keeps the index of tail element (index of last element of the queue)



  2. Functions:


    1. bool isEmpty():checks whether the queue is empty or not. Returns True or False


    2. bool isFull():checks whether the queue is full or not. Returns True or False.


    3. int size():returns the current size of the queue


    4. void enqueue(int number):adds a new element to the queue


    5. int dequeue():removes the front element from queue and returns it from function.


    6. int peek():returns the front element of the queue without removing it.


    7. void print():prints the queue elements from front to top (tail)



Nov 03, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here