CJCoding With Joseph
15free / daySign inCreate account

Reverse Input with Reverse Iterators

Write a program that reads whole numbers from standard input until there is no more input (end of file), stores them in a vector<int>, and then prints them in reverse order on one line, each number followed by a single space, ending with a newline. Use rbegin()/rend() to do the reversing — do not sort or use std::reverse.

The input is one or more integers separated by spaces or newlines, for example:
1 2 3 4

Expected Output:

4 3 2 1
8 7

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

Hints4 available
Topics:
STL ContainersIterators
📥 Auto-Input:
1 2 3 4\n
This input is automatically fed to your program's stdin
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.