fork download
  1. #include <iostream>
  2. #include <sstream>
  3. using namespace std;
  4.  
  5. int main() {
  6. istringstream input(R"inp(
  7. 23 43 12 67
  8. 18 15 22
  9. 12 xxx 23 12 xx 34556 11 11 www
  10. )inp");
  11.  
  12. int get, count = 0;
  13.  
  14. while (input >> get)
  15. count++;
  16.  
  17. cout << "Number of integers: " << count << endl;
  18.  
  19. int *array = new int [count];
  20.  
  21.  
  22. for (int i = 0; i < count; i++)
  23. {
  24. input >> array[i];
  25. }
  26. for (int i = 0; i < count; i++)
  27. {
  28. cout << *(array+i) << endl;
  29. }
  30.  
  31. delete[] array;
  32. return 0;
  33. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
Number of integers: 8
-1217944384
-1217944384
-1
538976266
540226080
824193844
926294066
538970656