← Back to STL Containers
Question 485
Serve the Front Customer
Serve the Front Customer
Write a functionvoid serve(queue<string>& line)that serves the customer at the front ofline: printServing:followed by the front name on its own line, then remove that customer withline.pop(). You may assume the queue is not empty whenserveis called. Example: if the line holds Ann then Bob, callingserve(line)prints: Serving: Ann and afterwards Bob is at the front (the first test then printsNext: Bob; the second test serves a line with one person and printsSize: 0). Do NOT write a main function.
Expected Output:
Serving: Ann Next: Bob Serving: Zoe Size: 0
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
STL ContainersQueues
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.