fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. vector<int> num;
  7. cout << "enter numbers: " << endl;
  8. int i;
  9. while (cin >> i)
  10. num.push_back(i);
  11. for (auto v: num)
  12. cout << v << " ";
  13. return 0; }
  14.  
Success #stdin #stdout 0.01s 5548KB
stdin
1 2 3 4 5
stdout
enter numbers: 
1 2 3 4 5