that stores string values. In the template, you're provided with prototypes of the bles/functions, but leave public function prototypes unchanged. You may use a implement the member functions in the StringQueue.cpp file (not provided). A te ue(int n) Initializes the queue. n is the maximum size of the queue. (if) 0.04 alle alle

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 5PE
icon
Related questions
icon
Concept explainers
Question

In c++, please and thank you.

StringQueue.h provided.

StringQueue
A regular queue that stores string values. In the template, you're provided with prototypes of the public member functions. Feel free to add
any private variables/functions, but leave public function prototypes unchanged. You may use a linked list or an array to store the strings.
You will need to implement the member functions in the StringQueue.cpp file (not provided). A test driver is provided in "downloadable files".
• StringQueue(int n) Initializes the queue. n is the maximum size of the queue.
• ~String Queue () Cleans up the dynamically allocated memory (if any). Must be defined, even if empty.
• int enqueue(string); Adds strings to the queue. returns the position of the string in the added queue (front of queue is position 1, hint:
it's the number of elements). It should not succeed if the queue is full.
• string dequeue() Returns the next value. It should not succeed if the queue is empty.
• bool isEmpty() Returns true if the queue is empty, otherwise returns false.
• bool isFull() Returns true if the queue is full, otherwise returns false. The queue is full if it contains n elements, where n is the
maximum size of the queue (from the constructor).
• void display(ostream& out) outputs the elements in the queue numbered starting at 1, one per line, from front to rear, to the ostream.
Use out in place of cout.
Transcribed Image Text:StringQueue A regular queue that stores string values. In the template, you're provided with prototypes of the public member functions. Feel free to add any private variables/functions, but leave public function prototypes unchanged. You may use a linked list or an array to store the strings. You will need to implement the member functions in the StringQueue.cpp file (not provided). A test driver is provided in "downloadable files". • StringQueue(int n) Initializes the queue. n is the maximum size of the queue. • ~String Queue () Cleans up the dynamically allocated memory (if any). Must be defined, even if empty. • int enqueue(string); Adds strings to the queue. returns the position of the string in the added queue (front of queue is position 1, hint: it's the number of elements). It should not succeed if the queue is full. • string dequeue() Returns the next value. It should not succeed if the queue is empty. • bool isEmpty() Returns true if the queue is empty, otherwise returns false. • bool isFull() Returns true if the queue is full, otherwise returns false. The queue is full if it contains n elements, where n is the maximum size of the queue (from the constructor). • void display(ostream& out) outputs the elements in the queue numbered starting at 1, one per line, from front to rear, to the ostream. Use out in place of cout.
#include <string>
4 using namespace std;
345
6
7 class String Queue
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
private:
//add your member variables here
//you may use an array or linked list or
public:
};
// Constructor
StringQueue (int);
~StringQueue (); // you can remove this if you're using a static array
// Queue operations
int enqueue (string); //returns position where inserted, front is 1
string dequeue ();
bool isEmpty();
bool is Full();
void display (ostream& out);
Transcribed Image Text:#include <string> 4 using namespace std; 345 6 7 class String Queue 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 private: //add your member variables here //you may use an array or linked list or public: }; // Constructor StringQueue (int); ~StringQueue (); // you can remove this if you're using a static array // Queue operations int enqueue (string); //returns position where inserted, front is 1 string dequeue (); bool isEmpty(); bool is Full(); void display (ostream& out);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning