Write a program that reads an expression consisting of two non-negative integer and an operator. determine if either integer or the result of the expression is too large to be represented as a ''normal ''signed integer (TypeIntegerIf you are working Pascal, TypeIntIf you are working in C ).
Input
An unspecified number of lines. Each line will contain an integer, one of the two operators+Or*, And another integer.
Output
For each line of input, print the input followed by 0-3 lines containing as values of these three messages as are appropriate :''First number too big'',''Second number too big'',''Result too big''.
Sample Input
300 + 39999999999999999999999 + 11
Sample output
300 + 39999999999999999999999 + 11first number too bigresult too big
Originally, it was a simulation question. After wa 7 times, we had no choice but to directly go to the atof function. This function converts the input string to a float (double) type)
#include<cstdio>#include <cstdlib>#include <iostream>#include <cstring>using namespace std;const int MAX=2147483647;int main(){char op,a[1100],b[1100];while(cin>>a>>op>>b){cout<<a<<" "<<op<<" "<<b<<endl;double x=atof(a),y=atof(b);if(x>MAX)cout<<"first number too big"<<endl;if(y>MAX)cout<<"second number too big"<<endl;if(op=='+'){double ans=x+y;if(ans>MAX)cout<<"result too big"<<endl;}if(op=='*'){double ans=x*y;if(ans>MAX)cout<<"result too big"<<endl;}}return 0;}