Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ (Screenshot of output please) Program 1 Write a queue class to implement a queue using an circular array of 12 string elements. Test

In C++ (Screenshot of output please)

Program 1

Write a queue class to implement a queue using an circular array of 12 string elements.

Test the program with the following sequence of code:

queue myQ; ( Use default constructor to initialize front and end to zero. )

cout<< myQ.size() << endl; // number of elements in queue

myQ.dequeue(); // Try to deqeue when the queue is empty. Should catch UNDERFLOW

myQ.enqueue("Fred");

myQ.enqueue("Liv");

myQ.enqueue("Julie");

myQ.enqueue("Rich");

myQ.enqueue("William");

myQ.enqueue("Olo");

myQ.enqueue("Xi");

myQ.enqueue("Chu");

myQ.enqueue("Annie");

myQ.enqueue("Carlos");

myQ.enqueue("Tuyet");

myQ.enqueue("Sue");

myQ.enqueue("Penny"); // Add 1 to many, should catch OVERFLOW

cout<< myQ.front() << endl; // index value

cout<< myQ.end() << endl; // index value

cout<< myQ.size() << endl; // number of elements in queue

cout << myQ.dequeue() << endl;

cout << myQ.dequeue() << endl;

cout << myQ.dequeue() << endl;;

myQ.enqueue("Olive");

myQ.enqueue("Jim");

cout << myQ.dequeue() << endl;

cout << myQ.dequeue() << endl;

cout<< myQ.front() << endl; // index value

cout<< myQ.end() << endl; // index value

cout<< myQ.size() << endl; // number of elements in 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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago