Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
Question
Book Icon
Chapter 18, Problem 6PC
Program Plan Intro

Dynamic String Queue

Program Plan:

  • Include the required header files.
  • Declare a class Dynque that creates a queue and store all the elements in the queue.
    • Declare all the variables present in the class.
    • Declare the front and rear pointers and the number of items.
    • Create a constructor to allocate elements in queue.
    • Create a destructor to deallocate elements in queue.
    • Create a function void Dynque<T>::enqueue(T val)that inserts the value in the variable val at the rear end of queue.
    • Create a function  void Dynque<T>::dequeue(T &val)that removes the value at the  front of the queue, and copies it into val.
    • Create a boolean function to check if queue is empty and a function clear to dequeue all elements present in the queue.
  • Declare the main function.
    • Prompt the user to enqueue 5 strings into the queue.
    • Dequeue and retrieve all items present in the queue.

Blurred answer
Students have asked these similar questions
Stacks and Queues are called data structures because their operations are specialized.
java data structure   Queue: Q4: A program performs the following operations on an empty queue Q: Q.enqueue(24) Q.enqueue(74) Q.enqueue(34) Q.first() Q.dequeue() Q.enqueue(12) Q.dequeue() Please show the queue contents at the end of these operations. Clearly show the front of the queue.
None
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
CMPTR
Computer Science
ISBN:9781337681872
Author:PINARD
Publisher:Cengage