二级题库50套.docx
- 文档编号:10417794
- 上传时间:2023-05-25
- 格式:DOCX
- 页数:137
- 大小:43.49KB
二级题库50套.docx
《二级题库50套.docx》由会员分享,可在线阅读,更多相关《二级题库50套.docx(137页珍藏版)》请在冰点文库上搜索。
二级题库50套
校园网·新视野教育二级C上机考试复习资料V16.0
(共50套题目)
第1套校园网·新视野教育上机考试复习资料
1、程序填空题
#include
#include
doublefun(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()
{doublex,y;
x=2.5;
y=fun(x);
printf("\nTheresultis:
\n");
printf("x=%-12.6fy=%-12.6f\n",x,y);
}
2、程序修改题校园网·新视野教育上机考试复习资料
#include
longfun(intx,inty,long*p)
{inti;
longt=1;
/**************found**************/
for(i=1;i t=t*x; *p=t; /**************found**************/ t=t/1000; returnt; } main() {longt,r;intx,y; printf("\nInputxandy: ");scanf("%ld%ld",&x,&y); t=fun(x,y,&r); printf("\n\nx=%d,y=%d,r=%ld,last=%ld\n\n",x,y,r,t); } 3、程序设计题校园网·新视野教育上机考试复习资料 #include #include doublefun(doublex) { } main() {doublex,s; printf("Inputx: ");scanf("%lf",&x); s=fun(x); printf("s=%f\n",s); } 第01套填空题: 【1.1.1】x 【1.1.2】n 【1.1.3】fabs(t) 改错题: 【1.2.1】for(i=1;i<=y;i++) 【1.2.2】t=t%1000; 第2套校园网·新视野教育上机考试复习资料 1、程序填空题 #include intc1,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() {longn=123114350L; fun(n); printf("\nTheresult: \n"); printf("n=%ldc1=%dc2=%dc3=%d\n",n,c1,c2,c3); } 2、程序修改题校园网·新视野教育上机考试复习资料 #include intfun(unsignedn,int*zero) {intcount=0,max=0,t; do {t=n%10; /**************found**************/ if(t=0) count++; if(max n=n/10; }while(n); /**************found**************/ zero=count; returnmax; } main() {unsignedn;intzero,max; printf("\nInputn(unsigned): ");scanf("%d",&n); max=fun(n,&zero); printf("\nTheresult: max=%dzero=%d\n",max,zero); } 3、程序设计题校园网·新视野教育上机考试复习资料 #include doublefun(intn) { } main() {intn;doubles; printf("\nInputn: ");scanf("%d",&n); s=fun(n); printf("\n\ns=%f\n\n",s); } 第02套填空题: 【2.1.1】n%10 【2.1.2】break 【2.1.3】break 改错题: 【2.2.1】if(t==0) 【2.2.2】*zero=count; 第3套校园网·新视野教育上机考试复习资料 1、程序填空题 #include unsignedlongfun(unsignedlongn) {unsignedlongx=0;intt; while(n) {t=n%10; /**********found**********/ if(t%2==__1__) /**********found**********/ x=__2__+t; /**********found**********/ n=__3__; } returnx; } main() {unsignedlongn=-1; while(n>99999999||n<0) {printf("Pleaseinput(0 ");scanf("%ld",&n);} printf("\nTheresultis: %ld\n",fun(n)); } 2、程序修改题校园网·新视野教育上机考试复习资料 #include voidfun(longs,long*t) {intd; longsl=1; /************found************/ t=0; while(s>0) {d=s%10; /************found************/ if(d%2==0) {*t=d*sl+*t; sl*=10; } s/=10; } } main() {longs,t; printf("\nPleaseenters: ");scanf("%ld",&s); fun(s,&t); printf("Theresultis: %ld\n",t); } 3、程序设计题校园网·新视野教育上机考试复习资料 #include voidfun(charp1[],charp2[]) { } main() printf("Enters1ands2: \n"); scanf("%s%s",s1,s2); printf("s1=%s\n",s1); printf("s2=%s\n",s2); printf("Invokefun(s1,s2): \n"); fun(s1,s2); printf("Afterinvoking: \n"); printf("%s\n",s1); } 第03套填空题: 【3.1.1】0 【3.1.2】10*x 【3.1.3】n/10 改错题: 【3.2.1】*t=0; 【3.2.2】if(d%2! =0) 第4套校园网·新视野教育上机考试复习资料 1、程序填空题 #include #defineM3 #defineN4 voidfun(int(*a)[N]) {inti=0,j,find=0,rmax,c,k;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 二级 题库 50