UVA

来源:互联网 发布:淘宝订单数据 编辑:程序博客网 时间:2024/06/16 03:54

#include<cstdio>

#include<cstdlib>

#include<iostream>

#include<cstring>

usingnamespacestd;

constint MAX = 2147483647;

intmain(){

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;

}

}

return0;

}

原创粉丝点击