Drain a Queue
easyQuestion 480A queue<int> named q already holds 1, 2, 3 (1 is at the front).
Write a loop that runs while the queue is not empty. On each pass print the front value followed by a single space, then remove it with q.pop(). The newline after the loop is already written for you - do not add another one.
(A trailing space after the 3 is fine.)
Expected output
1 2 3= newline. The output ends with a newline, so print one after the last line.
Hints3 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.