fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4. #include <vector>
  5. #include <algorithm>
  6. #include <stdio.h>
  7. #include <sstream>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13. const int max_int = 2147483647;
  14. double a, b;
  15. char x;
  16.  
  17. string str;
  18. while (getline(cin, str) && str[0] != EOF)
  19. {
  20. cout << str << endl;
  21. istringstream is(str);
  22. is >> a >> x >> b;
  23.  
  24. if (a > max_int) cout << "first number too big" << endl;
  25. if (b > max_int) cout << "second number too big" << endl;
  26. if (x == '+' && a + b > max_int || x == '*' && a*b >= max_int) cout << "result too big" << endl;
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
Standard output is empty