❶ c语言高精度计算 整数减法
#include<stdio.h>
#include<string.h>
#include<malloc.h>
constintMAXSIZE=200+1;
//完成以字符串形式的两个大数相加。返回字符串形式的和。
//tatol←addnum1+addnum2
char*LargeNumberAdd(charconst*addnum1,charconst*addnum2,char*total){
inti,j,k=0,len,result,carry=0;
intlen1=strlen(addnum1);
intlen2=strlen(addnum2);
for(i=len1-1,j=len2-1;i>=0&&j>=0;--i,--j){
result=addnum1[i]-'0'+addnum2[j]-'0'+carry;
carry=result/10;
total[k++]=result%10+'0';
}
while(i>=0){
result=addnum1[i--]-'0'+carry;
carry=result/10;
total[k++]=result%10+'0';
}
while(j>=0){
result=addnum2[j--]-'0'+carry;
carry=result/10;
total[k++]=result%10+'0';
}
total[k]='