题目1003:A+B------------------------写的复杂了点

AC:

#include<stdio.h>
int main()
{
    char str1[12],str2[12];
    while(scanf("%s %s",&str1,&str2)!=EOF)
    { 
        int f1=1,f2=1,i=0,j=0; 
        long long int res=0,tem1=0,tem2=0;
        for (i=0;str1[i]!='';i++)
            {
            if (str1[0]=='-') f1=-1; 
            if (str1[i]!=','&&str1[i]!='-')
              tem1=tem1*10+(str1[i]-'0');
            }
           
          tem1=f1*tem1;
         for (j=0;str2[j]!='';j++)
          {
          if (str2[0]=='-') f2=-1;
           if (str2[j]!=','&&str2[j]!='-')
              tem2=tem2*10+(str2[j]-'0');
           }
          tem2=f2*tem2;
        res=tem1+tem2;
        printf("%ld
",res);
    }
    return 0;
} 
原文地址:https://www.cnblogs.com/jianrenguo/p/6486500.html