CJCoding With Joseph
15free / daySign inCreate account

Write a function void serve(queue<string>& line) that serves the customer at the front of line: print Serving: followed by the front name on its own line, then remove that customer with line.pop(). You may assume the queue is not empty when serve is called.

Example: if the line holds Ann then Bob, calling serve(line) prints: Serving: Ann

and afterwards Bob is at the front (the first test then prints Next: Bob; the second test serves a line with one person and prints Size: 0).

Do NOT write a main function.

Expected output

Serving: Ann
Next: Bob
Serving: Zoe
Size: 0

= newline. The output ends with a newline, so print one after the last line.

Hints2 available
Topics
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.