Question
C++ You will be assigned the following: Queue Linked List (FIFO) Here is what they will need to do: QUEUE Implement a node class that
C++
You will be assigned the following:
Queue Linked List (FIFO)
Here is what they will need to do:
QUEUE
Implement a node class that contains
a number field (int) in the private area,
and appropriate constructors and
getid and setid public member functions.
Do this in node.cpp and node.h
Then implement a main.cpp that will create a queue of the nodes using a C++ array (no vectors or other STL components allowed).
The nodes should be implemented as a Singly Linked List.In main.cpp you should create functions to be called in main to do the enqueue, dequeue and isempty functionalities.
At the beginning of main you should
Continuously ask for a positive number to queue,
Until the user enters a negative number
Add the number to the queue.
Prompt the user as "# added to queue".
Then ask how many numbers to dequeue.
Dequeue that many times (loop!)
Prompt the user as "# removed from queue".
Once the queue is empty, simply stop removing numbers and prompt the user with "queue is empty!"
Finally, print the queue to the screen.
Should be in the correct ORDER for a queue.
If the queue is empty, don't print.
Have the program exit automatically.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started