A queue is a restricted data structure that allows only the following operations:
a.Enqueue" an item at the end" of the queue.
b.Dequeue" an item from the beginning" of the queue.
These should correlate with your intuitive notion of a queue (line) in the physical world. In queues the first element added to the queue will be the first one to be removed, i.e. elements are removed in the same order they were entered.
Note that there is no means of direct access to items that aren't on beginning or end of the queue.
Create a class queue with integer attribute count which represents the number of elements in the queue and a char array data of 100 elements where elements of the queue are actually saved.
Provide a constructor function that initialize the of elements in the array to zero and two member functions: function void enqueue (char) and function char dequeue (). The first is used to insert a character to the queue and the second to remove a character from the queue.
You must separate the interface from the implementation. Write a main function to test your class
See the sample output below
the Sample out put is just like that :
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
2
Sorry there are no elements in the queue
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
1
Enter a character: C
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
1
Enter a character: F
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
1
Enter a character: T
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
3
Your queue is C F T
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
2
C has been removed from your queue
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
3
Your queue is F T
Please enter 1 to enqueue, 2 to dequeue an element, 3 to print the queue, 4 to exist the program?
4
Thanks for using the queue program