资源描述:
《计算机 二级C语言复习资料.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、校园网·新视野教育二级C上机考试复习资料V16.0(共50套题目)第1套校园网·新视野教育上机考试复习资料1、程序填空题#include#includedoublefun(doublex){doublef,t;intn;f=1.0+x;/**********found**********/t=x1___;n=1;do{n++;/**********found**********/t*=(-1.0)*x/___n2___;f+=t;}/**********foun
2、d**********/while(___fab(t)3___>=1e-6);returnf;}main(){doublex,y;x=2.5;y=fun(x);printf("Theresultis:");printf("x=%-12.6fy=%-12.6f",x,y);}2、程序修改题校园网·新视野教育上机考试复习资料#includelongfun(intx,inty,long*p){inti;longt=1;/**************found*******
3、*******/for(i=1;i<=y;i++)t=t*x;*p=t;/**************found**************/t=t/%1000;returnt;}main(){longt,r;intx,y;printf("Inputxandy:");scanf("%ld%ld",&x,&y);t=fun(x,y,&r);printf("x=%d,y=%d,r=%ld,last=%ld",x,y,r,t);}3、程序设计题校园网·新视野教育上机考试复习资料#i
4、nclude#includedoublefun(doublex){}main(){doublex,s;printf("Inputx:");scanf("%lf",&x);s=fun(x);printf("s=%f",s);}第2套校园网·新视野教育上机考试复习资料1、程序填空题#includeintc1,c2,c3;voidfun(longn){c1=c2=c3=0;while(n){/**********found**********/s
5、witch(___n%101___){/**********found**********/case1:c1++;___break2___;/**********found**********/case2:c2++;___break3___;case3:c3++;}n/=10;}}main(){longn=L;fun(n);printf("Theresult:");printf("n=%ldc1=%dc2=%dc3=%d",n,c1,c2,c3);}2、程序修改题校园网·新视野教育上
6、机考试复习资料#includeintfun(unsignedn,int*zero){intcount=0,max=0,t;do{t=n%10;/**************found**************/if(t===0)count++;if(max7、;printf("Inputn(unsigned):");scanf("%d",&n);max=fun(n,&zero);printf("Theresult:max=%dzero=%d",max,zero);}3、程序设计题校园网·新视野教育上机考试复习资料#includedoublefun(intn){}main(){intn;doubles;printf("Inputn:");scanf("%d",&n);s=fun(n);printf("s=%f
8、n",s);}第3套校园网·新视野教育上机考试复习资料1、程序填空题#includeunsignedlongfun(unsignedlongn){unsignedlongx=0;intt;while(n){t=n%10;/**********found**********/if(t%2==__01__)/**********found**********/x=__10*x2__+t;/**********found**********/n=__n/103__;}return