• 202.50 KB
  • 2022-04-22 11:18:29 发布

C程序设计(第四版)谭浩强_课后习题答案_共11章

  • 60页
  • 当前文档由用户上传发布,收益归属用户
  1. 1、本文档共5页,可阅读全部内容。
  2. 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
  3. 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
  4. 文档侵权举报电话:19940600175。
'1-5#includeintmain(){printf("**************************nn");printf("VeryGood!nn");printf("**************************n");return0;}1-6#includeintmain(){inta,b,c,max;printf("pleaseinputa,b,c:n");scanf("%d,%d,%d",&a,&b,&c);max=a;if(max#includeintmain(){floatp,r,n;r=0.1;n=10;p=pow(1+r,n);printf("p=%fn",p);return0;}3-2-1#include#includeintmain(){floatr5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5;p=1000;r5=0.0585;r3=0.054;r2=0.0468;r1=0.0414;r0=0.0072;p1=p*((1+r5)*5);//一次存5年期p2=p*(1+2*r2)*(1+3*r3);//先存2年期,到期后将本息再存3年期p3=p*(1+3*r3)*(1+2*r2);//先存3年期,到期后将本息再存2年期60 p4=p*pow(1+r1,5);//存1年期,到期后将本息存再存1年期,连续存5次p5=p*pow(1+r0/4,4*5);//存活期存款。活期利息每一季度结算一次printf("p1=%fn",p1);//输出按第1方案得到的本息和printf("p2=%fn",p2);//输出按第2方案得到的本息和printf("p3=%fn",p3);//输出按第3方案得到的本息和printf("p4=%fn",p4);//输出按第4方案得到的本息和printf("p5=%fn",p5);//输出按第5方案得到的本息和return0;}3-2-2#include#includeintmain(){doubler5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5;p=1000;r5=0.0585;r3=0.054;r2=0.0468;r1=0.0414;r0=0.0072;p1=p*((1+r5)*5);//一次存5年期p2=p*(1+2*r2)*(1+3*r3);//先存2年期,到期后将本息再存3年期p3=p*(1+3*r3)*(1+2*r2);//先存3年期,到期后将本息再存2年期p4=p*pow(1+r1,5);//存1年期,到期后将本息存再存1年期,连续存5次p5=p*pow(1+r0/4,4*5);//存活期存款。活期利息每一季度结算一次printf("p1=%fn",p1);//输出按第1方案得到的本息和printf("p2=%fn",p2);//输出按第2方案得到的本息和printf("p3=%fn",p3);//输出按第3方案得到的本息和printf("p4=%fn",p4);//输出按第4方案得到的本息和printf("p5=%fn",p5);//输出按第5方案得到的本息和return0;}3-2-3#include#includeintmain(){floatr5,r3,r2,r1,r0,p,p1,p2,p3,p4,p5;p=1000;r5=0.0585;r3=0.054;r2=0.0468;r1=0.0414;r0=0.0072;60 p1=p*((1+r5)*5);//一次存5年期p2=p*(1+2*r2)*(1+3*r3);//先存2年期,到期后将本息再存3年期p3=p*(1+3*r3)*(1+2*r2);//先存3年期,到期后将本息再存2年期p4=p*pow(1+r1,5);//存1年期,到期后将本息存再存1年期,连续存5次p5=p*pow(1+r0/4,4*5);//存活期存款。活期利息每一季度结算一次printf("p1=%10.2fn",p1);//输出按第1方案得到的本息和printf("p2=%10.2fn",p2);//输出按第2方案得到的本息和printf("p3=%10.2fn",p3);//输出按第3方案得到的本息和printf("p4=%10.2fn",p4);//输出按第4方案得到的本息和printf("p5=%10.2fn",p5);//输出按第5方案得到的本息和return0;}3-3.#include#includeintmain(){floatd=300000,p=6000,r=0.01,m;m=log10(p/(p-d*r))/log10(1+r);printf("m=%6.2fn",m);return0;}3-4#includeintmain(){intc1,c2;c1=197;c2=198;printf("c1=%c,c2=%cn",c1,c2);printf("c1=%d,c2=%dn",c1,c2);return0;}3-5#includeintmain(){inta,b;floatx,y;charc1,c2;scanf("a=%db=%d",&a,&b);scanf("%f%e",&x,&y);scanf("%c%c",&c1,&c2);printf("a=%d,b=%d,x=%f,y=%f,c1=%c,c2=%cn",a,b,x,y,c1,c2);return0;}60 3-6#includeintmain(){charc1="C",c2="h",c3="i",c4="n",c5="a";c1=c1+4;c2=c2+4;c3=c3+4;c4=c4+4;c5=c5+4;printf("passworis%c%c%c%c%cn",c1,c2,c3,c4,c5);return0;}3-7#includeintmain(){floath,r,l,s,sq,vq,vz;floatpi=3.141526;printf("请输入圆半径r,圆柱高h∶");scanf("%f,%f",&r,&h);//要求输入圆半径r和圆柱高hl=2*pi*r;//计算圆周长ls=r*r*pi;//计算圆面积ssq=4*pi*r*r;//计算圆球表面积sqvq=3.0/4.0*pi*r*r*r;//计算圆球体积vqvz=pi*r*r*h;//计算圆柱体积vzprintf("圆周长为:l=%6.2fn",l);printf("圆面积为:s=%6.2fn",s);printf("圆球表面积为:sq=%6.2fn",sq);printf("圆球体积为:v=%6.2fn",vq);printf("圆柱体积为:vz=%6.2fn",vz);return0;}3-8-1#includeintmain(){intc1,c2;//整型定义printf("请输入两个整数c1,c2:");scanf("%d,%d",&c1,&c2);printf("按字符输出结果:n");printf("%c,%cn",c1,c2);printf("按ASCII码输出结果为:n");printf("%d,%dn",c1,c2);return0;}60 3-8-2#includeintmain(){charc1,c2;//定义字符型变量inti1,i2;//定义整型变量printf("请输入两个字符c1,c2:");scanf("%c,%c",&c1,&c2);i1=c1;//赋值给整型变量i2=c2;printf("按字符输出结果:n");printf("%c,%cn",i1,i2);printf("按整数输出结果:n");printf("%d,%dn",c1,c2);return0;}3-8-3#includeintmain(){charc1,c2;//定义为字符型inti1,i2;//定义为整型printf("请输入两个整数i1,i2:");scanf("%d,%d",&i1,&i2);c1=i1;//将整数赋值给字符变量c2=i2;printf("按字符输出结果:n");printf("%c,%cn",c1,c2);printf("按整数输出结果:n");printf("%d,%dn",c1,c2);return0;}3-8#includeintmain(){charc1,c2;printf("请输入两个字符c1,c2:");c1=getchar();c2=getchar();printf("用putchar语句输出结果为:");putchar(c1);putchar(c2);printf("n");60 printf("用printf语句输出结果为:");printf("%c%cn",c1,c2);return0;}4-4-1#includeintmain(){inta,b,c;printf("请输入三个整数:");scanf("%d,%d,%d",&a,&b,&c);if(aintmain(){inta,b,c,temp,max;printf("请输入三个整数:");scanf("%d,%d,%d",&a,&b,&c);temp=(a>b)?a:b;/*将a和b中的大者存入temp中*/max=(temp>c)?temp:c;/*将a和b中的大者与c比较,取最大者*/printf("三个整数的最大数是%dn",max);return0;}4-5#include#include#defineM1000intmain(){inti,k;printf("请输入一个小于%d的整数i:",M);scanf("%d",&i);if(i>M){printf("输入的数不符合要求,请重新输入一个小于%d的整数i:",M);60 scanf("%d",&i);}k=sqrt(i);printf("%d的平方根的整数部分是:%dn",i,k);return0;}4-6.#includeintmain(){intx,y;printf("输入x:");scanf("%d",&x);if(x<1)/*x<1*/{y=x;printf("x=%3d,y=x=%dn",x,y);}elseif(x<10)/*1==10*/{y=3*x-11;printf("x=%d,y=3*x-11=%dn",x,y);}return0;}4-8#includeintmain(){floatscore;chargrade;printf("请输入学生成绩:");scanf("%f",&score);while(score>100||score<0){printf("n输入有误,请重输");scanf("%f",&score);}switch((int)(score/10)){case10:case9:grade="A";break;case8:grade="B";break;case7:grade="C";break;case6:grade="D";break;case5:60 case4:case3:case2:case1:case0:grade="E";}printf("成绩是%5.1f,相应的等级是%cn",score,grade);return0;}4-10-1#includeintmain(){inti;doublebonus,bon1,bon2,bon4,bon6,bon10;bon1=100000*0.1;bon2=bon1+100000*0.075;bon4=bon2+100000*0.05;bon6=bon4+100000*0.03;bon10=bon6+400000*0.015;printf("请输入利润i:");scanf("%d",&i);if(i<=100000)bonus=i*0.1;elseif(i<=200000)bonus=bon1+(i-100000)*0.075;elseif(i<=400000)bonus=bon2+(i-200000)*0.05;elseif(i<=600000)bonus=bon4+(i-400000)*0.03;elseif(i<=1000000)bonus=bon6+(i-600000)*0.015;elsebonus=bon10+(i-1000000)*0.01;printf("奖金是:%10.2fn",bonus);return0;}4-10-2#includeintmain(){inti;doublebonus,bon1,bon2,bon4,bon6,bon10;intbranch;60 bon1=100000*0.1;bon2=bon1+100000*0.075;bon4=bon2+200000*0.05;bon6=bon4+200000*0.03;bon10=bon6+400000*0.015;printf("请输入利润i:");scanf("%d",&i);branch=i/100000;if(branch>10)branch=10;switch(branch){case0:bonus=i*0.1;break;case1:bonus=bon1+(i-100000)*0.075;break;case2:case3:bonus=bon2+(i-200000)*0.05;break;case4:case5:bonus=bon4+(i-400000)*0.03;break;case6:case7:case8:case9:bonus=bon6+(i-600000)*0.015;break;case10:bonus=bon10+(i-1000000)*0.01;}printf("奖金是%10.2fn",bonus);return0;}4-11#includeintmain(){intt,a,b,c,d;printf("请输入四个数:");scanf("%d,%d,%d,%d",&a,&b,&c,&d);printf("a=%d,b=%d,c=%d,d=%dn",a,b,c,d);if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(a>d){t=a;a=d;d=t;}if(b>c){t=b;b=c;c=t;}if(b>d){t=b;b=d;d=t;}if(c>d){t=c;c=d;d=t;}60 printf("排序结果如下:n");printf("%d%d%d%dn",a,b,c,d);return0;}4-12#includeintmain(){inth=10;floatx1=2,y1=2,x2=-2,y2=2,x3=-2,y3=-2,x4=2,y4=-2,x,y,d1,d2,d3,d4;printf("请输入一个点(x,y):");scanf("%f,%f",&x,&y);d1=(x-x4)*(x-x4)+(y-y4)*(y-y4);/*求该点到各中心点距离*/d2=(x-x1)*(x-x1)+(y-y1)*(y-y1);d3=(x-x2)*(x-x2)+(y-y2)*(y-y2);d4=(x-x3)*(x-x3)+(y-y3)*(y-y3);if(d1>1&&d2>1&&d3>1&&d4>1)h=0;/*判断该点是否在塔外*/printf("该点高度为%dn",h);return0;}5-3#includeintmain(){intp,r,n,m,temp;printf("请输入两个正整数n,m:");scanf("%d,%d,",&n,&m);if(nintmain(){charc;intletters=0,space=0,digit=0,other=0;printf("请输入一行字符:n");while((c=getchar())!="n"){if(c>="a"&&c<="z"||c>="A"&&c<="Z")letters++;elseif(c=="")space++;elseif(c>="0"&&c<="9")digit++;elseother++;}printf("字母数:%dn空格数:%dn数字数:%dn其它字符数:%dn",letters,space,digit,other);return0;}5-5#includeintmain(){inta,n,i=1,sn=0,tn=0;printf("a,n=:");scanf("%d,%d",&a,&n);while(i<=n){tn=tn+a;/*赋值后的tn为i个a组成数的值*/sn=sn+tn;/*赋值后的sn为多项式前i项之和*/a=a*10;++i;}printf("a+aa+aaa+...=%dn",sn);return0;}5-6#includeintmain(){doubles=0,t=1;intn;for(n=1;n<=20;n++)60 {t=t*n;s=s+t;}printf("1!+2!+...+20!=%22.15en",s);return0;}5-7#includeintmain(){intn1=100,n2=50,n3=10;doublek,s1=0,s2=0,s3=0;for(k=1;k<=n1;k++)/*计算1到100的和*/{s1=s1+k;}for(k=1;k<=n2;k++)/*计算1到50各数的平方和*/{s2=s2+k*k;}for(k=1;k<=n3;k++)/*计算1到10的各倒数和*/{s3=s3+1/k;}printf("sum=%15.6fn",s1+s2+s3);return0;}5-8#includeintmain(){inti,j,k,n;printf("parcissusnumbersare");for(n=100;n<1000;n++){i=n/100;j=n/10-i*10;k=n%10;if(n==i*i*i+j*j*j+k*k*k)printf("%d",n);}printf("n");return0;}5-9#includeintmain(){intm,s,i;for(m=2;m<1000;m++)60 {s=0;for(i=1;iintmain(){inti,n=20;doublea=2,b=1,s=0,t;for(i=1;i<=n;i++){s=s+a/b;t=a,a=a+b,b=t;}printf("sum=%16.10fn",s);return0;}5-11#includeintmain(){doublesn=100,hn=sn/2;intn;for(n=2;n<=10;n++){sn=sn+2*hn;/*第n次落地时共经过的米数*/hn=hn/2;/*第n次反跳高度*/}printf("第10次落地时共经过%f米n",sn);printf("第10次反弹%f米n",hn);return0;}5-1260 #includeintmain(){intday,x1,x2;day=9;x2=1;while(day>0){x1=(x2+1)*2;/*第1天的桃子数是第2天桃子数加1后的2倍.*/x2=x1;day--;}printf("total=%dn",x1);return0;}5-13#include#includeintmain(){floata,x0,x1;printf("enterapositivenumber:");scanf("%f",&a);x0=a/2;x1=(x0+a/x0)/2;do{x0=x1;x1=(x0+a/x0)/2;}while(fabs(x0-x1)>=1e-5);printf("Thesquarerootof%5.2fis%8.5fn",a,x1);return0;}5-14#include#includeintmain(){doublex1,x0,f,f1;x1=1.5;do{x0=x1;f=((2*x0-4)*x0+3)*x0-6;f1=(6*x0-8)*x0+3;x1=x0-f/f1;}while(fabs(x1-x0)>=1e-5);printf("Therootofequationis%5.2fn",x1);60 return0;}5-15#include#includeintmain(){floatx0,x1,x2,fx0,fx1,fx2;do{printf("enterx1&x2:");scanf("%f,%f",&x1,&x2);fx1=x1*((2*x1-4)*x1+3)-6;fx2=x2*((2*x2-4)*x2+3)-6;}while(fx1*fx2>0);do{x0=(x1+x2)/2;fx0=x0*((2*x0-4)*x0+3)-6;if((fx0*fx1)<0){x2=x0;fx2=fx0;}else{x1=x0;fx1=fx0;}}while(fabs(fx0)>=1e-5);printf("x=%6.2fn",x0);return0;}5-16#includeintmain(){inti,j,k;for(i=0;i<=3;i++){for(j=0;j<=2-i;j++)printf("");for(k=0;k<=2*i;k++)printf("*");printf("n");}for(i=0;i<=2;i++){for(j=0;j<=i;j++)printf("");for(k=0;k<=4-2*i;k++)printf("*");60 printf("n");}return0;}5-17#includeintmain(){chari,j,k;/*是a的对手;j是b的对手;k是c的对手*/for(i="x";i<="z";i++)for(j="x";j<="z";j++)if(i!=j)for(k="x";k<="z";k++)if(i!=k&&j!=k)if(i!="x"&&k!="x"&&k!="z")printf("A--%cnB--%cnC--%cn",i,j,k);return0;}6-1#include#includeintmain(){inti,j,n,a[101];for(i=1;i<=100;i++)a[i]=i;a[1]=0;for(i=2;iintmain(){inti,j,min,temp,a[11];printf("enterdata:n");for(i=1;i<=10;i++){printf("a[%d]=",i);scanf("%d",&a[i]);}printf("n");printf("Theorginalnumbers:n");for(i=1;i<=10;i++)printf("%5d",a[i]);printf("n");for(i=1;i<=9;i++){min=i;for(j=i+1;j<=10;j++)if(a[min]>a[j])min=j;temp=a[i];a[i]=a[min];a[min]=temp;}printf("nThesortednumbers:n");for(i=1;i<=10;i++)printf("%5d",a[i]);printf("n");return0;}6-3#includeintmain(){inta[3][3],sum=0;inti,j;printf("enterdata:n");for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%3d",&a[i][j]);for(i=0;i<3;i++)sum=sum+a[i][i];printf("sum=%6dn",sum);return0;60 }6-4#includeintmain(){inta[11]={1,4,6,9,13,16,19,28,40,100};inttemp1,temp2,number,end,i,j;printf("arraya:n");for(i=0;i<10;i++)printf("%5d",a[i]);printf("n");printf("insertdata:");scanf("%d",&number);end=a[9];if(number>end)a[10]=number;else{for(i=0;i<10;i++){if(a[i]>number){temp1=a[i];a[i]=number;for(j=i+1;j<11;j++){temp2=a[j];a[j]=temp1;temp1=temp2;}break;}}}printf("Nowarraya:n");for(i=0;i<11;i++)printf("%5d",a[i]);printf("n");return0;}6-5#include#defineN5intmain(){inta[N],i,temp;printf("enterarraya:n");for(i=0;i#defineN10intmain(){inti,j,a[N][N];for(i=0;iintmain(){inta[15][15],i,j,k,p,n;p=1;while(p==1){printf("entern(n=1--15):");scanf("%d",&n);if((n!=0)&&(n<=15)&&(n%2!=0))p=0;}60 for(i=1;i<=n;i++)for(j=1;j<=n;j++)a[i][j]=0;j=n/2+1;a[1][j]=1;for(k=2;k<=n*n;k++){i=i-1;j=j+1;if((i<1)&&(j>n)){i=i+2;j=j-1;}else{if(i<1)i=n;if(j>n)j=1;}if(a[i][j]==0)a[i][j]=k;else{i=i+2;j=j-1;a[i][j]=k;}}for(i=1;i<=n;i++){for(j=1;j<=n;j++)printf("%5d",a[i][j]);printf("n");}return0;}6-8#include#defineN4#defineM5/*数组为4行5列*/intmain(){inti,j,k,a[N][M],max,maxj,flag;printf("pleaseinputmatrix:n");for(i=0;imax){max=a[i][j];/*将本行的最大数存放在max中*/maxj=j;/*将最大数所在的列号存放在maxj中*/}flag=1;/*先假设是鞍点,以flag为1代表*/for(k=0;ka[k][maxj])/*将最大数和其同列元素相比*/{flag=0;/*如果max不是同列最小,表示不是鞍点令flag1为0*/continue;}if(flag)/*如果flag1为1表示是鞍点*/{printf("a[%d][%d]=%dn",i,maxj,max);/*输出鞍点的值和所在行列号*/break;}}if(!flag)/*如果flag为0表示鞍点不存在*/printf("Itisnotexist!n");return0;}6-9#include#defineN15intmain(){inti,number,top,bott,mid,loca,a[N],flag=1,sign;charc;printf("enterdata:n");scanf("%d",&a[0]);i=1;while(i=a[i-1])i++;elseprintf("enterthisdataagain:n");}printf("n");for(i=0;ia[N-1]))//要查的数不在查找区间内loca=-1;//表示找不到while((!sign)&&(top<=bott)){mid=(bott+top)/2;if(number==a[mid]){loca=mid;printf("Hasfound%d,itspositionis%dn",number,loca+1);sign=1;}elseif(numberintmain(){inti,j,upp,low,dig,spa,oth;chartext[3][80];upp=low=dig=spa=oth=0;for(i=0;i<3;i++){printf("pleaseinputline%d:n",i+1);gets(text[i]);for(j=0;j<80&&text[i][j]!="";j++){if(text[i][j]>="A"&&text[i][j]<="Z")upp++;elseif(text[i][j]>="a"&&text[i][j]<="z")low++;elseif(text[i][j]>="0"&&text[i][j]<="9")dig++;elseif(text[i][j]=="")spa++;else60 oth++;}}printf("nuppercase:%dn",upp);printf("lowercase:%dn",low);printf("digit:%dn",dig);printf("space:%dn",spa);printf("other:%dn",oth);return0;}6-11#includeintmain(){chara[5]={"*","*","*","*","*"};inti,j,k;charspace="";for(i=0;i<5;i++){printf("n");printf("");for(j=1;j<=i;j++)printf("%c",space);for(k=0;k<5;k++)printf("%c",a[k]);}printf("n");return0;}6-12a-c#includeintmain(){intj,n;charch[80],tran[80];printf("inputciphercode:");gets(ch);printf("nciphercode:%s",ch);j=0;while(ch[j]!=""){if((ch[j]>="A")&&(ch[j]<="Z"))tran[j]=155-ch[j];elseif((ch[j]>="a")&&(ch[j]<="z"))tran[j]=219-ch[j];elsetran[j]=ch[j];j++;60 }n=j;printf("noriginaltext:");for(j=0;jintmain(){intj,n;charch[80];printf("inputciphercode:n");gets(ch);printf("nciphercode:%sn",ch);j=0;while(ch[j]!=""){if((ch[j]>="A")&&(ch[j]<="Z"))ch[j]=155-ch[j];elseif((ch[j]>="a")&&(ch[j]<="z"))ch[j]=219-ch[j];elsech[j]=ch[j];j++;}n=j;printf("originaltext:");for(j=0;jintmain(){chars1[80],s2[40];inti=0,j=0;printf("inputstring1:");scanf("%s",s1);printf("inputstring2:");scanf("%s",s2);while(s1[i]!="")i++;60 while(s2[j]!="")s1[i++]=s2[j++];s1[i]="";printf("nThenewstringis:%sn",s1);return0;}6-14#includeintmain(){inti,resu;chars1[100],s2[100];printf("inputstring1:");gets(s1);printf("ninputstring2:");gets(s2);i=0;while((s1[i]==s2[i])&&(s1[i]!=""))i++;if(s1[i]==""&&s2[i]=="")resu=0;elseresu=s1[i]-s2[i];printf("nresult:%d.n",resu);return0;}6-15#include#includeintmain(){chars1[80],s2[80];inti;printf("inputs2:");scanf("%s",s2);for(i=0;i<=strlen(s2);i++)s1[i]=s2[i];printf("s1:%sn",s1);return0;}7-1-1#includeintmain(){inthcf(int,int);intlcd(int,int,int);intu,v,h,l;scanf("%d,%d",&u,&v);60 h=hcf(u,v);printf("H.C.F=%dn",h);l=lcd(u,v,h);printf("L.C.D=%dn",l);return0;}inthcf(intu,intv){intt,r;if(v>u){t=u;u=v;v=t;}while((r=u%v)!=0){u=v;v=r;}return(v);}intlcd(intu,intv,inth){return(u*v/h);}7-1-2#includeintHcf,Lcd;intmain(){voidhcf(int,int);voidlcd(int,int);intu,v;scanf("%d,%d",&u,&v);hcf(u,v);lcd(u,v);printf("H.C.F=%dn",Hcf);printf("L.C.D=%dn",Lcd);return0;}voidhcf(intu,intv){intt,r;if(v>u){t=u;u=v;v=t;}while((r=u%v)!=0){u=v;v=r;}60 Hcf=v;}voidlcd(intu,intv){Lcd=u*v/Hcf;}7-2#include#includefloatx1,x2,disc,p,q;intmain(){voidgreater_than_zero(float,float);voidequal_to_zero(float,float);voidsmaller_than_zero(float,float);floata,b,c;printf("inputa,b,c:");scanf("%f,%f,%f",&a,&b,&c);printf("equation:%5.2f*x*x+%5.2f*x+%5.2f=0n",a,b,c);disc=b*b-4*a*c;printf("root:n");if(disc>0){greater_than_zero(a,b);printf("x1=%fttx2=%fn",x1,x2);}elseif(disc==0){equal_to_zero(a,b);printf("x1=%fttx2=%fn",x1,x2);}else{smaller_than_zero(a,b);printf("x1=%f+%fitx2=%f-%fin",p,q,p,q);}return0;}voidgreater_than_zero(floata,floatb){x1=(-b+sqrt(disc))/(2*a);x2=(-b-sqrt(disc))/(2*a);}voidequal_to_zero(floata,floatb){60 x1=x2=(-b)/(2*a);}voidsmaller_than_zero(floata,floatb){p=-b/(2*a);q=sqrt(-disc)/(2*a);}7-3#includeintmain(){intprime(int);intn;printf("inputaninteger:");scanf("%d",&n);if(prime(n))printf("%disaprime.n",n);elseprintf("%disnotaprime.n",n);return0;}intprime(intn){intflag=1,i;for(i=2;i#defineN3intarray[N][N];intmain(){voidconvert(intarray[][3]);inti,j;printf("inputarray:n");for(i=0;i#includeintmain(){voidinverse(charstr[]);charstr[100];printf("inputstring:");scanf("%s",str);inverse(str);printf("inversestring:%sn",str);return0;}voidinverse(charstr[]){chart;inti,j;for(i=0,j=strlen(str);i<(strlen(str)/2);i++,j--){t=str[i];str[i]=str[j-1];str[j-1]=t;}}60 7-6#includeintmain(){voidconcatenate(charstring1[],charstring2[],charstring[]);chars1[100],s2[100],s[100];printf("inputstring1:");scanf("%s",s1);printf("inputstring2:");scanf("%s",s2);concatenate(s1,s2,s);printf("nThenewstringis%sn",s);return0;}voidconcatenate(charstring1[],charstring2[],charstring[]){inti,j;for(i=0;string1[i]!="";i++)string[i]=string1[i];for(j=0;string2[j]!="";j++)string[i+j]=string2[j];string[i+j]="";}7-7#includeintmain(){voidcpy(char[],char[]);charstr[80],c[80];printf("inputstring:");gets(str);cpy(str,c);printf("Thevowellettersare:%sn",c);return0;}voidcpy(chars[],charc[]){inti,j;for(i=0,j=0;s[i]!="";i++)if(s[i]=="a"||s[i]=="A"||s[i]=="e"||s[i]=="E"||s[i]=="i"||s[i]=="I"||s[i]=="o"||s[i]=="O"||s[i]=="u"||s[i]=="U"){c[j]=s[i];j++;}c[j]="";60 }7-8#include#includeintmain(){charstr[80];voidinsert(char[]);printf("inputfourdigits:");scanf("%s",str);insert(str);return0;}voidinsert(charstr[]){inti;for(i=strlen(str);i>0;i--){str[2*i]=str[i];str[2*i-1]="";}printf("output:n%sn",str);}7-9#includeintletter,digit,space,others;intmain(){voidcount(char[]);chartext[80];printf("inputstring:n");gets(text);printf("string:");puts(text);letter=0;digit=0;space=0;others=0;count(text);printf("nletter:%dndigit:%dnspace:%dnothers:%dn",letter,digit,space,others);return0;}voidcount(charstr[]){inti;for(i=0;str[i]!="";i++)if((str[i]>="a"&&str[i]<="z")||(str[i]>="A"&&str[i]<="Z"))60 letter++;elseif(str[i]>="0"&&str[i]<="9")digit++;elseif(str[i]==32)space++;elseothers++;}7-10#include#includeintmain(){intalphabetic(char);intlongest(char[]);inti;charline[100];printf("inputoneline:n");gets(line);printf("Thelongestwordis:");for(i=longest(line);alphabetic(line[i]);i++)printf("%c",line[i]);printf("n");return0;}intalphabetic(charc){if((c>="a"&&c<="z")||(c>="A"&&c<="z"))return(1);elsereturn(0);}intlongest(charstring[]){intlen=0,i,length=0,flag=1,place=0,point;for(i=0;i<=strlen(string);i++)if(alphabetic(string[i]))if(flag){point=i;flag=0;}elselen++;else{flag=1;60 if(len>=length){length=len;place=point;len=0;}}return(place);}7-11#include#include#defineN10charstr[N];intmain(){voidsort(char[]);inti,flag;for(flag=1;flag==1;){printf("inputstring:n");scanf("%s",&str);if(strlen(str)>N)printf("stringtoolong,inputagain!");elseflag=0;}sort(str);printf("stringsorted:n");for(i=0;istr[i+1]){t=str[i];str[i]=str[i+1];str[i+1]=t;}}60 7-12#include#includeintmain(){floatsolut(floata,floatb,floatc,floatd);floata,b,c,d;printf("inputa,b,c,d:");scanf("%f,%f,%f,%f",&a,&b,&c,&d);printf("x=%10.7fn",solut(a,b,c,d));return0;}floatsolut(floata,floatb,floatc,floatd){floatx=1,x0,f,f1;do{x0=x;f=((a*x0+b)*x0+c)*x0+d;f1=(3*a*x0+2*b)*x0+c;x=x0-f/f1;}while(fabs(x-x0)>=1e-3);return(x);}7-16#include#defineMAX1000intmain(){inthtoi(chars[]);intc,i,flag,flag1;chart[MAX];i=0;flag=0;flag1=1;printf("inputaHEXnumber:");while((c=getchar())!=""&&i="0"&&c<="9"||c>="a"&&c<="f"||c>="A"&&c<="F"){flag=1;t[i++]=c;}elseif(flag){t[i]="";printf("decimalnumber%dn",htoi(t));printf("continueornot?");60 c=getchar();if(c=="N"||c=="n")flag1=0;else{flag=0;i=0;printf("ninputaHEXnumber:");}}}return0;}inthtoi(chars[]){inti,n;n=0;for(i=0;s[i]!="";i++){if(s[i]>="0"&&s[i]<="9")n=n*16+s[i]-"0";if(s[i]>="a"&&s[i]<="f")n=n*16+s[i]-"a"+10;if(s[i]>="A"&&s[i]<="F")n=n*16+s[i]-"A"+10;}return(n);}7-17#includeintmain(){voidconvert(intn);intnumber;printf("inputaninteger:");scanf("%d",&number);printf("output:");if(number<0){putchar("-");putchar("");/*先输出一个‘-’号和空格*/number=-number;}convert(number);printf("n");return0;}voidconvert(intn)60 {inti;if((i=n/10)!=0)convert(i);putchar(n%10+"0");putchar(32);}7-18#includeintmain(){intsum_day(intmonth,intday);intleap(intyear);intyear,month,day,days;printf("inputdate(year,month,day):");scanf("%d,%d,%d",&year,&month,&day);printf("%d/%d/%d",year,month,day);days=sum_day(month,day);/*调用函数sum_day*/if(leap(year)&&month>=3)/*调用函数leap*/days=days+1;printf("isthe%dthdayinthisyear.n",days);return0;}intsum_day(intmonth,intday)/*函数sum_day:计算日期*/{intday_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};inti;for(i=1;iintmain(){voidswap(int*p1,int*p2);intn1,n2,n3;int*p1,*p2,*p3;printf("inputthreeintegern1,n2,n3:");scanf("%d,%d,%d",&n1,&n2,&n3);p1=&n1;60 p2=&n2;p3=&n3;if(n1>n2)swap(p1,p2);if(n1>n3)swap(p1,p3);if(n2>n3)swap(p2,p3);printf("Now,theorderis:%d,%d,%dn",n1,n2,n3);return0;}voidswap(int*p1,int*p2){intp;p=*p1;*p1=*p2;*p2=p;}8-2#include#includeintmain(){voidswap(char*,char*);charstr1[20],str2[20],str3[20];printf("inputthreeline:n");gets(str1);gets(str2);gets(str3);if(strcmp(str1,str2)>0)swap(str1,str2);if(strcmp(str1,str3)>0)swap(str1,str3);if(strcmp(str2,str3)>0)swap(str2,str3);printf("Now,theorderis:n");printf("%sn%sn%sn",str1,str2,str3);return0;}voidswap(char*p1,char*p2){charp[20];strcpy(p,p1);strcpy(p1,p2);strcpy(p2,p);}8-3#includeintmain(){voidinput(int*);voidmax_min_value(int*);voidoutput(int*);intnumber[10];input(number);max_min_value(number);60 output(number);return0;}voidinput(int*number){inti;printf("input10numbers:");for(i=0;i<10;i++)scanf("%d",&number[i]);}voidmax_min_value(int*number){int*max,*min,*p,temp;max=min=number;for(p=number+1;p*max)max=p;elseif(*p<*min)min=p;temp=number[0];number[0]=*min;*min=temp;if(max==number)max=min;temp=number[9];number[9]=*max;*max=temp;}voidoutput(int*number){int*p;printf("Now,theyare:");for(p=number;pintmain(){voidmove(int[20],int,int);intnumber[20],n,m,i;printf("howmanynumbers?");scanf("%d",&n);printf("input%dnumbers:n",n);for(i=0;iarray;p--)*p=*(p-1);*array=array_end;m--;if(m>0)move(array,n,m);}8-5#includeintmain(){inti,k,m,n,num[50],*p;printf("ninputnumberofperson:n=");scanf("%d",&n);p=num;for(i=0;iintmain(){intlength(char*p);60 intlen;charstr[20];printf("inputstring:");scanf("%s",str);len=length(str);printf("Thelengthofstringis%d.n",len);return0;}intlength(char*p){intn;n=0;while(*p!=""){n++;p++;}return(n);}8-7#include#includeintmain(){voidcopystr(char*,char*,int);intm;charstr1[20],str2[20];printf("inputstring:");gets(str1);printf("whichcharacterthatbegintocopy?");scanf("%d",&m);if(strlen(str1)intmain(){intupper=0,lower=0,digit=0,space=0,other=0,i=0;char*p,s[20];printf("inputstring:");while((s[i]=getchar())!="n")i++;p=&s[0];while(*p!="n"){if(("A"<=*p)&&(*p<="Z"))++upper;elseif(("a"<=*p)&&(*p<="z"))++lower;elseif(*p=="")++space;elseif((*p<="9")&&(*p>="0"))++digit;else++other;p++;}printf("uppercase:%dlowercase:%d",upper,lower);printf("space:%ddigit:%dother:%dn",space,digit,other);return0;}8-9#includeintmain(){voidmove(int*pointer);inta[3][3],*p,i;printf("inputmatrix:n");for(i=0;i<3;i++)scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);p=&a[0][0];move(p);printf("Now,matrix:n");60 for(i=0;i<3;i++)printf("%d%d%dn",a[i][0],a[i][1],a[i][2]);return0;}voidmove(int*pointer){inti,j,t;for(i=0;i<3;i++)for(j=i;j<3;j++){t=*(pointer+3*i+j);*(pointer+3*i+j)=*(pointer+3*j+i);*(pointer+3*j+i)=t;}}8-11-1#include#includeintmain(){voidsort(chars[][6]);inti;charstr[10][6];printf("input10strings:n");for(i=0;i<10;i++)scanf("%s",str[i]);sort(str);printf("Now,thesequenceis:n");for(i=0;i<10;i++)printf("%sn",str[i]);return0;}voidsort(chars[10][6]){inti,j;char*p,temp[10];p=temp;for(i=0;i<9;i++)for(j=0;j<9-i;j++)if(strcmp(s[j],s[j+1])>0){strcpy(p,s[j]);strcpy(s[j],s[+j+1]);strcpy(s[j+1],p);}}8-11-260 #include#includeintmain(){voidsort(char(*p)[6]);inti;charstr[10][6];char(*p)[6];printf("input10strings:n");for(i=0;i<10;i++)scanf("%s",str[i]);p=str;sort(p);printf("Now,thesequenceis:n");for(i=0;i<10;i++)printf("%sn",str[i]);return0;}voidsort(char(*s)[6]){inti,j;chartemp[6],*t=temp;for(i=0;i<9;i++)for(j=0;j<9-i;j++)if(strcmp(s[j],s[j+1])>0){strcpy(t,s[j]);strcpy(s[j],s[+j+1]);strcpy(s[j+1],t);}}8-12#include#includeintmain(){voidsort(char*[]);inti;char*p[10],str[10][20];for(i=0;i<10;i++)p[i]=str[i];printf("input10strings:n");for(i=0;i<10;i++)scanf("%s",p[i]);sort(p);printf("Now,thesequenceis:n");for(i=0;i<10;i++)60 printf("%sn",p[i]);return0;}voidsort(char*s[]){inti,j;char*temp;for(i=0;i<9;i++)for(j=0;j<9-i;j++)if(strcmp(*(s+j),*(s+j+1))>0){temp=*(s+j);*(s+j)=*(s+j+1);*(s+j+1)=temp;}}8-14#includeintmain(){voidsort(char*p,intm);inti,n;char*p,num[20];printf("inputn:");scanf("%d",&n);printf("pleaseinputthesenumbers:n");for(i=0;iintmain(){intstrcmp(char*p1,char*p2);intm;charstr1[20],str2[20],*p1,*p2;printf("inputtwostrings:n");scanf("%s",str1);scanf("%s",str2);p1=&str1[0];p2=&str2[0];m=strcmp(p1,p2);printf("result:%d,n",m);return0;}intstrcmp(char*p1,char*p2)//两个字符串比较函数{inti;i=0;while(*(p1+i)==*(p2+i))if(*(p1+i++)=="")return(0);//相等时返回结果0return(*(p1+i)-*(p2+i));//不等时返回结果为第一个不等字符ASCII码的差值}8-18#includeintmain(){char*month_name[13]={"illegalmonth","January","February","March","April","May","June","july","August","September","October","November","December"};intn;printf("inputmonth:n");scanf("%d",&n);if((n<=12)&&(n>=1))printf("Itis%s.n",*(month_name+n));elseprintf("Itiswrong.n");return0;}8-19-1#include#defineNEWSIZE1000//指定开辟存区的最大容量charnewbuf[NEWSIZE];//定义字符数组newbufchar*newp=newbuf;//定义指针变量newp,指向可存区的始端60 char*new(intn)//定义开辟存区的函数new,开辟存储区后返回指针{if(newp+n<=newbuf+NEWSIZE)//开辟区未超过newbuf数组的大小{newp+=n;//newp指向存储区的末尾return(newp-n);//返回一个指针,它指向存区的开始位置}elsereturn(NULL);//当存区不够分配时,返回一个空指针}8-19-2#include#defineNEWSIZE1000charnewbuf[NEWSIZE];char*newp=newbuf;voidfree(char*p)//释放存区函数{if(p>=newbuf&&p0)/*比较后交换字符串地址*/{temp=*(p+i);60 *(p+i)=*(p+j);*(p+j)=temp;}}}return0;}8-21#includeintmain(){voidsort(int**p,intn);inti,n,data[20],**p,*pstr[20];printf("inputn:n");scanf("%d",&n);for(i=0;i**(p+j))//比较后交换整数地址{temp=*(p+i);*(p+i)=*(p+j);*(p+j)=temp;}}}}9-1-1#includestruct{intyear;intmonth;60 intday;}date;intmain(){intdays;printf("inputyear,month,day:");scanf("%d,%d,%d",&date.year,&date.month,&date.day);switch(date.month){case1:days=date.day;break;case2:days=date.day+31;break;case3:days=date.day+59;break;case4:days=date.day+90;break;case5:days=date.day+120;break;case6:days=date.day+151;break;case7:days=date.day+181;break;case8:days=date.day+212;break;case9:days=date.day+243;break;case10:days=date.day+273;break;case11:days=date.day+304;break;case12:days=date.day+334;break;}if((date.year%4==0&&date.year%100!=0||date.year%400==0)&&date.month>=3)days+=1;printf("%d/%disthe%dthdayin%d.n",date.month,date.day,days,date.year);return0;}9-1-2#includestruct{intyear;intmonth;intday;}date;intmain(){inti,days;intday_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};printf("inputyear,month,day:");scanf("%d,%d,%d",&date.year,&date.month,&date.day);days=0;for(i=1;i=3)days=days+1;printf("%d/%disthe%dthdayin%d.n",date.month,date.day,days,date.year);60 return0;}9-2-1#includestructy_m_d{intyear;intmonth;intday;}date;intmain(){intdays(structy_m_ddate1);printf("inputyear,month,day:");scanf("%d,%d,%d",&date.year,&date.month,&date.day);printf("%d/%disthe%dthdayin%d.n",date.month,date.day,days(date),date.year);}intdays(structy_m_ddate1){intsum;switch(date1.month){case1:sum=date1.day;break;case2:sum=date1.day+31;break;case3:sum=date1.day+59;break;case4:sum=date1.day+90;break;case5:sum=date1.day+120;break;case6:sum=date1.day+151;break;case7:sum=date1.day+181;break;case8:sum=date1.day+212;break;case9:sum=date1.day+243;break;case10:sum=date1.day+273;break;case11:sum=date1.day+304;break;case12:sum=date1.day+334;break;}if((date1.year%4==0&&date1.year%100!=0||date1.year%400==0)&&date1.month>=3)sum+=1;return(sum);}9-2-2#includestructy_m_d{intyear;intmonth;intday;}date;60 intmain(){intdays(intyear,intmonth,intday);intdays(int,int,int);intday_sum;printf("inputyear,month,day:");scanf("%d,%d,%d",&date.year,&date.month,&date.day);day_sum=days(date.year,date.month,date.day);printf("%d/%disthe%dthdayin%d.n",date.month,date.day,day_sum,date.year);}intdays(intyear,intmonth,intday){intday_sum,i;intday_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};day_sum=0;for(i=1;i=3)day_sum+=1;return(day_sum);}9-3#include#defineN5structstudent{charnum[6];charname[8];intscore[4];}stu[N];intmain(){voidprint(structstudentstu[6]);inti,j;for(i=0;i#defineN5structstudent{charnum[6];charname[8];intscore[4];}stu[N];intmain(){voidinput(structstudentstu[]);voidprint(structstudentstu[]);input(stu);print(stu);return0;}voidinput(structstudentstu[]){inti,j;for(i=0;i#defineN10structstudent{charnum[6];charname[8];floatscore[3];floatavr;}stu[N];intmain(){inti,j,maxi;floatsum,max,average;for(i=0;imax){max=sum;maxi=i;}}average/=N;printf("NO.namescore1score2score3averagen");for(i=0;i#defineN13structperson{intnumber;intnextp;}link[N+1];intmain(){inti,count,h;for(i=1;i<=N;i++){if(i==N)link[i].nextp=1;elselink[i].nextp=i+1;link[i].number=i;60 }printf("n");count=0;h=N;printf("sequencethatpersonsleavethecircle:n");while(countstructstudent{longnum;floatscore;structstudent*next;};intn;structstudent*del(structstudent*head,longnum){structstudent*p1,*p2;if(head==NULL)//是空表{printf("nlistnull!n");return(head);}p1=head;//使p1指向第一个结点while(num!=p1->num&&p1->next!=NULL)//p1指向的不是所要找的结点且后面还有结点*/{p2=p1;p1=p1->next;}//p1后移一个结点if(num==p1->num)//找到了{if(p1==head)head=p1->next;//若p1指向的是首结点,把第二个结点地址赋予head*/60 elsep2->next=p1->next;//否则将下一结点地址赋给前一结点地址printf("delete:%ldn",num);n=n-1;}elseprintf("%ldnotbeenfound!n",num);//找不到该结点return(head);}9-8#includestructstudent{longnum;floatscore;structstudent*next;};intn;structstudent*insert(structstudent*head,structstudent*stud){structstudent*p0,*p1,*p2;p1=head;//使p1指向第一个结点p0=stud;//指向要插入的结点if(head==NULL)//原来的链表是空表{head=p0;p0->next=NULL;}//使p0指向的结点作为头结点else{while((p0->num>p1->num)&&(p1->next!=NULL)){p2=p1;//使p2指向刚才p1指向的结点p1=p1->next;}//p1后移一个结点if(p0->num<=p1->num){if(head==p1)head=p0;//插到原来第一个结点之前elsep2->next=p0;//插到p2指向的结点之后p0->next=p1;}else{p1->next=p0;p0->next=NULL;//插到最后的结点之后}}n=n+1;//结点数加1return(head);}9-10#include#include#defineLENsizeof(structstudent)60 structstudent{longnum;intscore;structstudent*next;};structstudentlista,listb;intn,sum=0;intmain(){structstudent*creat(void);structstudent*insert(structstudent*,structstudent*);voidprint(structstudent*);structstudent*ahead,*bhead,*abh;printf("inputlista:n");ahead=creat();sum=sum+n;printf("inputlistb:n");bhead=creat();sum=sum+n;abh=insert(ahead,bhead);print(abh);return0;}structstudent*creat(void)//建立链表函数{structstudent*p1,*p2,*head;n=0;p1=p2=(structstudent*)malloc(LEN);printf("inputnumber&scoresofstudent:n");printf("ifnumberis0,stopinputing.n");scanf("%ld,%d",&p1->num,&p1->score);head=NULL;while(p1->num!=0){n=n+1;if(n==1)head=p1;elsep2->next=p1;p2=p1;p1=(structstudent*)malloc(LEN);scanf("%ld,%d",&p1->num,&p1->score);}60 p2->next=NULL;return(head);}structstudent*insert(structstudent*ah,structstudent*bh)//插入函数{structstudent*pa1,*pa2,*pb1,*pb2;pa2=pa1=ah;pb2=pb1=bh;do{while((pb1->num>pa1->num)&&(pa1->next!=NULL)){pa2=pa1;pa1=pa1->next;}if(pb1->num<=pa1->num){if(ah==pa1)ah=pb1;elsepa2->next=pb1;pb1=pb1->next;pb2->next=pa1;pa2=pb2;pb2=pb1;}}while((pa1->next!=NULL)||(pa1==NULL&&pb1!=NULL));if((pb1!=NULL)&&(pb1->num>pa1->num)&&(pa1->next==NULL))pa1->next=pb1;return(ah);}voidprint(structstudent*head)//输出函数{structstudent*p;printf("Thereare%drecords:n",sum);p=head;if(p!=NULL)do{printf("%ld%dn",p->num,p->score);p=p->next;}while(p!=NULL);}9-11#include#include#defineLA4#defineLB560 structstudent{intnum;charname[8];structstudent*next;}a[LA],b[LB];intmain(){structstudenta[LA]={{101,"Wang"},{102,"Li"},{105,"Zhang"},{106,"Wei"}};structstudentb[LB]={{103,"Zhang"},{104,"Ma"},{105,"Chen"},{107,"Guo"},{108,"lui"}};inti;structstudent*p,*p1,*p2,*head1,*head2;head1=a;head2=b;printf("listA:n");for(p1=head1,i=1;i<=LA;i++){if(inext=a+i;elsep1->next=NULL;printf("%4d%8sn",p1->num,p1->name);if(inext;}printf("nlistB:n");for(p2=head2,i=1;i<=LB;i++){if(inext=b+i;elsep2->next=NULL;printf("%4d%8sn",p2->num,p2->name);if(inext;}p1=head1;while(p1!=NULL){p2=head2;while((p1->num!=p2->num)&&(p2->next!=NULL))p2=p2->next;if(p1->num==p2->num){if(p1==head1)head1=p1->next;else{p->next=p1->next;p1=p1->next;}}else{p=p1;p1=p1->next;}}60 printf("nresult:n");p1=head1;while(p1!=NULL){printf("%4d%7sn",p1->num,p1->name);p1=p1->next;}return0;}10-3#include#include#includeintmain(){FILE*fp;charstr[100];inti=0;if((fp=fopen("a1","w"))==NULL){printf("cannotopenfilen");exit(0);}printf("inputastring:n");gets(str);while(str[i]!="!"){if(str[i]>="a"&&str[i]<="z")str[i]=str[i]-32;fputc(str[i],fp);i++;}fclose(fp);fp=fopen("a1","r");fgets(str,strlen(str)+1,fp);printf("%sn",str);fclose(fp);return0;}10-4#include#includeintmain(){FILE*fp;inti,j,n,i1;charc[100],t,ch;60 if((fp=fopen("a1","r"))==NULL){printf("ncannotopenfilen");exit(0);}printf("fileA:n");for(i=0;(ch=fgetc(fp))!=EOF;i++){c[i]=ch;putchar(c[i]);}fclose(fp);i1=i;if((fp=fopen("b1","r"))==NULL){printf("ncannotopenfilen");exit(0);}printf("nfileB:n");for(i=i1;(ch=fgetc(fp))!=EOF;i++){c[i]=ch;putchar(c[i]);}fclose(fp);n=i;for(i=0;ic[j]){t=c[i];c[i]=c[j];c[j]=t;}printf("nfileC:n");fp=fopen("c1","w");for(i=0;i

您可能关注的文档