fork download
  1. #include <iostream>
  2. #include <stdexcept>
  3. #include <string>
  4. int main()
  5. {
  6. for(;;)
  7. {
  8. std::string line;
  9. getline(std::cin, line);
  10. if(line.empty())
  11. throw std::runtime_error("empty input");
  12. int n = stoi(line);
  13. std::cout << "You've entered " << n << '\n';
  14. }
  15. }
Runtime error #stdin #stdout 0s 2968KB
stdin
1
2
3

4
stdout
You've entered 1
You've entered 2
You've entered 3