|
|
@@ -0,0 +1,47 @@
|
|
|
+#include <algorithm>
|
|
|
+#include <array>
|
|
|
+#include <iostream>
|
|
|
+#include <map>
|
|
|
+#include <utility>
|
|
|
+#include <vector>
|
|
|
+#include <iomanip>
|
|
|
+#include <sstream>
|
|
|
+#include <climits>
|
|
|
+
|
|
|
+using namespace std;
|
|
|
+
|
|
|
+int main()
|
|
|
+{
|
|
|
+ double left, right, result;
|
|
|
+ string left_s, right_s;
|
|
|
+
|
|
|
+ char operation;
|
|
|
+ while(cin >> left_s >> operation >> right_s)
|
|
|
+ {
|
|
|
+ cout << left_s << " " << operation << " " << right_s << endl;
|
|
|
+ stringstream ss;
|
|
|
+ ss << left_s << " " << right_s;
|
|
|
+ ss >> left >> right;
|
|
|
+
|
|
|
+ if(left > INT_MAX)
|
|
|
+ {
|
|
|
+ cout << "first number too big" << endl;
|
|
|
+ }
|
|
|
+ if(right > INT_MAX)
|
|
|
+ {
|
|
|
+ cout << "second number too big" << endl;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(operation == '+')
|
|
|
+ result = left + right;
|
|
|
+ else
|
|
|
+ result = left * right;
|
|
|
+
|
|
|
+ if(result > INT_MAX)
|
|
|
+ {
|
|
|
+ cout << "result too big" << endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|