Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education