uva465 overflow

来源:互联网 发布:sql查询字段长度限制 编辑:程序博客网 时间:2024/05/21 16:58
#include<stdio.h> #include<stdlib.h> int main() {     char str1[1001],str2[1001],c;     double a,b;     while(scanf("%s %c %s",str1,&c,str2)!=EOF)     {         a=atof(str1);         b=atof(str2);         printf("%s %c %s\n",str1,c,str2);         if(a>2147483647)         printf("first number too big\n");         if(b>2147483647)         printf("second number too big\n");         if(c=='+')         {             if(a+b>2147483647)             printf("result too big\n");         }         if(c=='*')         {             if(a*b>2147483647)             printf("result too big\n");         }     }     return 0; }

0 0
原创粉丝点击