int compare(char *a,char *b)
if(strlen(a)>strlen(b))return 1;
if(strlen(a)<strlen(b)) return -1;
if(strcmp(a,b)>0)return 1;
if(strcmp(a,b)<0)return -1;
if(temp[0]=='+'||temp[0]=='-')
int len=(int)strlen(temp);
void add(char *c,char *a,char *b)
strcpy(A,b); strcpy(B,a);
strcpy(A,a); strcpy(B,b);
if(flag) temp=A[i]+B[i]-96;
c[i]=(temp+carry)%10+'0';
void mul(char *c,char *a,char *b)
c[0]='0'; c[1]='\0'; return;
temp1=(A[j]-48)*(B[i]-48);
c[i+j]=(temp1+temp2+carry)%10+'0';
carry=(temp1+temp2+carry)/10;
void sub(char *c,char *a,char *b)
if(compare(a,b)<0) flag=0;
void div(char *d,char *m,char *a,char *b)
strcpy(A,a); strcpy(B,b);
char temp[MAX+1],havetry[MAX],tryd[2];
int ina=strlen(B),ind=0,i,flag;
int len_A=(int)strlen(A);
if(strlen(temp)==strlen(B))
i=(temp[0]-'0')/(B[0]-'0'+1);
i=((temp[0]-'0')*10+temp[1]-'0')/(B[0]-'0'+1);
if(compare(havetry,temp)>0) break;
void transfer(char result[MAX],int n)
for(j=0;j<length;j++,i--)
int re_transfer(char result[MAX])
count=count*10+result[i]-'0';
void JieC(char result[MAX],int m)
char temp1[MAX],temp2[MAX];
void Cmn(char result[MAX],int m,int n)
char temp1[MAX],temp2[MAX],temp3[MAX];
for(i=m,j=1;i>=m-n+1;i--,j++)
div(result,temp3,temp2,temp1);
result=(result*10+ch[i]-'0')%n;
printf("Case %d:\n",r++);
printf("%s + %s = %s\n",a,b,c);
本文转自Phinecos(洞庭散人)博客园博客,原文链接:http://www.cnblogs.com/phinecos/archive/2007/03/09/669042.html,如需转载请自行联系原作者