fork(1) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main() {
  5. using namespace std;
  6. for (string line; getline(cin, line); ) {
  7. int i = stoi(line);
  8. cout << i << endl;
  9. }
  10. }
Runtime error #stdin #stdout #stderr 0s 3432KB
stdin
1
-1
             2
             3 rest
- 4
stdout
1
-1
2
3
stderr
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi