Ultraviolet A 465 -- Overflow (atof function)
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
#include
#include
#include
using namespace std;const int MAX=2147483647;int main(){char op,a[1100],b[1100];while(cin>>a>>op>>b){cout
MAX)cout<<"second number too big"<
MAX)cout<<"result too big"<
MAX)cout<<"result too big"<