STARTING OUT WITH C++ MPL
STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
Question
Book Icon
Chapter 18, Problem 7PC
Program Plan Intro

Queue Exceptions

Program Plan:

“main.cpp”:

  • This program features queues that can throw exceptions and print an appropriate error message and should terminate the program.
  • Include the required header files.
  • Prompt the user to enqueue 5 items.
  • Use of try – catch exceptional handling that returns error message and terminates the program if the queue overflows.
  • Prompt the user and allow user option to overflow the queue and dequeue the queue and print the values present in the queue.

“IntQueue.h”:

  • Include all the required header files.
  • Declare all the variables present in the queue along with their data types.
  • Declare all the function definition.
  • Declare the class underflow and overflow to check for exceptional handling in queue.

“IntQueue.cpp”:

  • Include all the required header files.
  • Call a constructor to create a queue and initialize its elements.
  • Initialize front and rear each to -1 and the number of elements initially present to 0.
  • A destructor is called to delete the queue array.
  • Define a queue function enqueue that inserts the value in variable num at the rear of the queue.
  • Define a queue function dequeue that deletes the value at the front of the queue, and copies it into variable.
  • Define a queue function isEmpty returns true if the queue is empty, and false if elements are present in the queue.
  • Define a Queue function is Full return true if queue is full and false if queue is not full.

Blurred answer
Students have asked these similar questions
solve and show the tree on paper
I need help to resolve the following activity
Modern life has been impacted immensely by computers. Computers have penetrated every aspect of oursociety, either for better or for worse. From supermarket scanners calculating our shopping transactionswhile keeping store inventory; robots that handle highly specialized tasks or even simple human tasks,computers do much more than just computing. But where did all this technology come from and whereis it heading? Does the future look promising or should we worry about computers taking over theworld? Or are they just a necessary evil? Provide three references with your answer.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning