I have a simple input which takes one integer.
int n
std::cin >> n
vector<int> vec;
What I would like to do next, is to accept 'n' number of integers all from the same line, and add them to the 'vec' vector.
So if my first input is 3, my next input should accept 3 numbers from the same line:
3
6 1 2
I tried using the for loop, but it obviously won't make those inputs come from the same line.
for(int i = 0; i < n; i++){
std::cin >> ...
}
What's the proper way to do this?
In Java I would simply put Java.util.Scanner.nextInt() in the for loop.