fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. std::vector<int> x;
  7. for (int i = 0, n ; i != 5 && cin >> n ; i++)
  8. x.push_back(n);
  9. for (int i = 0 ; i != x.size() ; i++)
  10. cout << x[i] << endl;
  11. return 0;
  12. }
Success #stdin #stdout 0s 4400KB
stdin
1
2
3
4
5
6
7
stdout
1
2
3
4
5