← Back to STL Containers
Question 488
Read Numbers Into a Queue
Read Numbers Into a Queue
Write a program that reads an integer N from standard input, followed by N integers (N is at least 1). Push each of the N integers onto a queue<int> in the order they are read. Then print the front value, the back value and the size on ONE line, in the exact format shown in Expected Output.
Example input:
4
3 5 7 9
If N is 1 and the only number is 42, the output is:
Front: 42 Back: 42 Size: 1Expected Output:
Front: 3 Back: 9 Size: 4 Front: 42 Back: 42 Size: 1
= newline. The output ends with a newline — print one after the last line.
Hints4 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.