Home / Expert Answers / Computer Science / in-c-please-given-main-complete-the-program-to-add-people-to-a-queue-the-program-should-read-i-pa815

(Solved): in c++ please Given main(, complete the program to add people to a queue. The program should read i ...



Given main(, complete the program to add people to a queue. The program should read in a list of peoples names including Yoin c++ please

Given main(, complete the program to add people to a queue. The program should read in a list of people's names including "You" (ending with -1), adding each person to the peopleInQueue queue. Then, remove each person from the queue until "You" is at the head of the queue. Include print statements as shown in the example below. Ex. If the input is: Zadie Smith Tom Sawyer You Louisa Alcott -1 Zadie Smith Tom Sawyer You Louisa Alcott the output is: Welcome to the ticketing service... You are number 3 in the queue. Zadie Smith has purchased a ticket. You are now number 2 Tom Sawyer has purchased a ticket. You are now number 1 You can now purchase your ticket! Welcome to the ticketing service... You are number 3 in the queue. Zadie Smith has purchased a ticket. You are now number 2 Tom Sawyer has purchased a ticket. You are now number 1 You can now purchase your ticket!


We have an Answer from Expert

View Expert Answer

Expert Answer



Here's an example implementation in C++: ``` #include #include #include int main() { std::queue peopleInQueue; std::string name; int position = 0; std::cout << "Welcome to the ticketing service..." << std::endl; // Read in names un...
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe