fork(1) download
  1. #include <sstream>
  2. #include <vector>
  3. #include <string>
  4. #include <iostream>
  5.  
  6. void foo(std::vector<int> &input)
  7. {
  8. for (const int &i : input)
  9. {
  10. std::cout << i << std::endl;
  11. }
  12. }
  13.  
  14. int main()
  15. {
  16. std::vector<int> vec;
  17. std::string buffer;
  18. int data;
  19. std::getline(std::cin, buffer);
  20. std::istringstream iss(buffer);
  21. while (iss >> data)
  22. vec.push_back(data);
  23. foo(vec);
  24. }
Success #stdin #stdout 0s 3468KB
stdin
1 2 3 4 5 6 7 8 9 100 200 300 400
stdout
1
2
3
4
5
6
7
8
9
100
200
300
400