欢迎来到天天文库
浏览记录
ID:57638421
大小:1.67 MB
页数:83页
时间:2020-08-29
《计算机二级C语言试题库.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、第83页共83页计算机二级C语言试题库第1套1、程序填空题#include#includedoublefun(doublex){doublef,t;intn;f=1.0+x;/**********found**********/t=___1___;n=1;do{n++;/**********found**********/t*=(-1.0)*x/___2___;f+=t;}/**********found**********/while(___3___>=1e-6);returnf;}main(
2、){doublex,y;x=2.5;y=fun(x);printf("Theresultis:");printf("x=%-12.6fy=%-12.6f",x,y);}2、程序修改题#include83第83页共83页longfun(intx,inty,long*p){inti;longt=1;/**************found**************/for(i=1;i3、0;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、程序设计题#include#includedoublefun(doublex){}main(){doublex,s;printf("Inputx:");scanf("%lf",&x);s=fun(x);pr4、intf("s=%f",s);}第2套1、程序填空题83第83页共83页#includeintc1,c2,c3;voidfun(longn){c1=c2=c3=0;while(n){/**********found**********/switch(___1___){/**********found**********/case1:c1++;___2___;/**********found**********/case2:c2++;___3___;case3:c3++;}n/=10;}}main(){lon5、gn=123114350L;fun(n);printf("Theresult:");printf("n=%ldc1=%dc2=%dc3=%d",n,c1,c2,c3);}2、程序修改题#includeintfun(unsignedn,int*zero){intcount=0,max=0,t;do{t=n%10;/**************found**************/if(t=0)count++;if(max6、*found**************/83第83页共83页zero=count;returnmax;}main(){unsignedn;intzero,max;printf("Inputn(unsigned):");scanf("%d",&n);max=fun(n,&zero);printf("Theresult:max=%dzero=%d",max,zero);}3、程序设计题#includedoublefun(intn){}main(){intn;doubles;printf("Inpu7、tn:");scanf("%d",&n);s=fun(n);printf("s=%f",s);}第3套校园网·新视野教育上机考试复习资料1、程序填空题#includeunsignedlongfun(unsignedlongn){unsignedlongx=0;intt;while(n){t=n%10;/**********found**********/if(t%2==__1__)/**********found**********/x=__2__+t;/**********found*****8、*****/n=__3__;}returnx;}83第83页共83页main(){unsignedlongn=-1;while(n>999999999、10、n<0){printf("Pleaseinput(0
3、0;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、程序设计题#include#includedoublefun(doublex){}main(){doublex,s;printf("Inputx:");scanf("%lf",&x);s=fun(x);pr
4、intf("s=%f",s);}第2套1、程序填空题83第83页共83页#includeintc1,c2,c3;voidfun(longn){c1=c2=c3=0;while(n){/**********found**********/switch(___1___){/**********found**********/case1:c1++;___2___;/**********found**********/case2:c2++;___3___;case3:c3++;}n/=10;}}main(){lon
5、gn=123114350L;fun(n);printf("Theresult:");printf("n=%ldc1=%dc2=%dc3=%d",n,c1,c2,c3);}2、程序修改题#includeintfun(unsignedn,int*zero){intcount=0,max=0,t;do{t=n%10;/**************found**************/if(t=0)count++;if(max6、*found**************/83第83页共83页zero=count;returnmax;}main(){unsignedn;intzero,max;printf("Inputn(unsigned):");scanf("%d",&n);max=fun(n,&zero);printf("Theresult:max=%dzero=%d",max,zero);}3、程序设计题#includedoublefun(intn){}main(){intn;doubles;printf("Inpu7、tn:");scanf("%d",&n);s=fun(n);printf("s=%f",s);}第3套校园网·新视野教育上机考试复习资料1、程序填空题#includeunsignedlongfun(unsignedlongn){unsignedlongx=0;intt;while(n){t=n%10;/**********found**********/if(t%2==__1__)/**********found**********/x=__2__+t;/**********found*****8、*****/n=__3__;}returnx;}83第83页共83页main(){unsignedlongn=-1;while(n>999999999、10、n<0){printf("Pleaseinput(0
6、*found**************/83第83页共83页zero=count;returnmax;}main(){unsignedn;intzero,max;printf("Inputn(unsigned):");scanf("%d",&n);max=fun(n,&zero);printf("Theresult:max=%dzero=%d",max,zero);}3、程序设计题#includedoublefun(intn){}main(){intn;doubles;printf("Inpu
7、tn:");scanf("%d",&n);s=fun(n);printf("s=%f",s);}第3套校园网·新视野教育上机考试复习资料1、程序填空题#includeunsignedlongfun(unsignedlongn){unsignedlongx=0;intt;while(n){t=n%10;/**********found**********/if(t%2==__1__)/**********found**********/x=__2__+t;/**********found*****
8、*****/n=__3__;}returnx;}83第83页共83页main(){unsignedlongn=-1;while(n>99999999
9、
10、n<0){printf("Pleaseinput(0
此文档下载收益归作者所有