Reverse Numbers from Input
mediumQuestion 512Write a program that reads integers from standard input until the input ends, pushes each one onto a stack<int>, and then pops them all to print the numbers in reverse order on one line, separated by single spaces, followed by a newline.
The numbers may be separated by spaces or newlines, and there is always at least one number.
Input example: 1 2 3 4
Expected output
4 3 2 1 30 20 10
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
STL ContainersStacks
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.