fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. int main() {
  4. std::string input = "Not a number";
  5. try
  6. {
  7. int num = std::stoi(input);
  8. if (num >= 0 && num < 10)
  9. {
  10. std::cout << "FILLER: Draw the input number";
  11. exit(0);
  12. }
  13. else {
  14. std::cout << "FILLER: This is the else statement";
  15. exit(1);
  16. }
  17. }
  18. catch (const std::exception& e)
  19. {
  20. std::cout << e.what();
  21. //std::cout << "That is not a valid number." << '\n';
  22. }
  23. }
Success #stdin #stdout 0s 4252KB
stdin
Standard input is empty
stdout
stoi