欢迎来到天天文库
浏览记录
ID:33024428
大小:54.40 KB
页数:7页
时间:2019-02-19
《应用多文件数组处理大整数的加减乘除》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#includeHstdio.hM#include"stdlib.h*'★includeHstring.hnincludeHf2.h"#include"f3.h"includeHf4.h"includeHf5.h"#definemax_len100intanl[max_len+10]={0};intan2[max_len+10]={0};intresult[max_len+10]={0};charstrl[max」en+10];charstr2[max_len+10];voidmain()intflag=l;printf(”print
2、f("====l:^<^n=========”);printf("====2:求差======H);printf(”====3:求积二二二二二二”);printf("====4:4
3、,pleaseinputagain:H);break;case1:add(anl,an2);break;case2:jian(anl,an2);break;case3:mul(anl,an2);break;case4:div(anl,an2);break;case5:exit(0);}#include"f2.h"#include"stdio.h"#include,,stdlib.hH#include^string.h"#definemaxjen100intadd(int*anlJnt*an2){charstrl[max_len+1
4、0];charstr2[max_len+10];scanf(”%s”,strl);scanf("%s",str2);inti,j;〃存储的字符串整数转换到anl屮去j=0;for(i=strlen(strl)-l;i>=0;i-)anl[j++]=strl[i]-'O';j=0;for(i=strlen(str2)-l;i>=0;i-)an2[j++]=str2[i]-'O';for(i=0;i=10){〃看是否进位anl[i]-=10;anl[i
5、+l]++;〃进位}boolbStartOutput=false;//跳过多余的零for(i=max_len;i>=0;i・・){讦(bStartOutput)printf("%d",anl[i]);//多余冬都跳过则退出elseif(anl[i]){printff'Thesumis%d",anl[i]);bStartOutput=true;}}for(j=0;j6、lib.h"#include"string.h"#definemax_len100intjian(int*anl,int*an2){charstrl[max」en+10];charstr2[max」en+10];inti,j;scanf(”%s”,strl);scanf("%s",str2);for(i=0;i=0;i-)anl[j++]=strl[i]-'0,;intnlen2=7、strlen(str2);j=0;for(i=nlen2-l;i>=0;i-)an2[j++]=str2[i]-,0,;for(i=0;i=0;i--){讦(bStartOutput)printf(“%d”,anl[i]);〃多余零都跳过则输出elseif(anl[i]){printf("Theresul8、tis%d",anl[i]);bStartOutput=true;}for(i=0;i
6、lib.h"#include"string.h"#definemax_len100intjian(int*anl,int*an2){charstrl[max」en+10];charstr2[max」en+10];inti,j;scanf(”%s”,strl);scanf("%s",str2);for(i=0;i=0;i-)anl[j++]=strl[i]-'0,;intnlen2=
7、strlen(str2);j=0;for(i=nlen2-l;i>=0;i-)an2[j++]=str2[i]-,0,;for(i=0;i=0;i--){讦(bStartOutput)printf(“%d”,anl[i]);〃多余零都跳过则输出elseif(anl[i]){printf("Theresul
8、tis%d",anl[i]);bStartOutput=true;}for(i=0;i
此文档下载收益归作者所有