ImageVerifierCode 换一换
格式:DOCX , 页数:66 ,大小:30.26KB ,
资源ID:7089445      下载积分:12 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7089445.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(浙江省计算机等级考试二级《C程序设计》上机考试题库.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

浙江省计算机等级考试二级《C程序设计》上机考试题库.docx

1、浙江省计算机等级考试二级C程序设计上机考试题库上机程序调试及程序设计练习 一、程序填空(1) 找Armstrong(水仙花)数:#include #include void main() int i,a,b,c; for(i=100;i=999;i+) a=i/100; _1_ c=i%10; 371=3*3*3+7*7*7+1*1*1 / b=i%100/10; if (_2_) / a*a*a+b*b*b+c*c*c = = i printf(%d is a Armstrong number!n,i); (2) 输入1 个整数后,输出该数的位数。(例:输入3214则输出 4,输入-2315

2、6则输出5)。#include void main() int n,k=0; scanf(%d,&n); while( _1_ ) k+; _2_; printf(%dn,k); / n!=0 / n=n/10 _ 3 _ lB彄QevetepT_OMepWNKTfiY倧Qe #include #include void main() int n,s=0; scanf(%d,&n); _ 1 _ while(n!=0) _ 2 _ n=n/10; printf(%dn,s); 234 R6彄Q 9fi彄Qe -312 R6彄Q 60_ / if (nP/n0_OY7傚zff弿Qe 12345f

3、iR6彄Q 543218傚zff弿Qe -34567fi R6彄Q -765430_ #include #include long f(long n) long m,y=0; m=fabs(n); while(m!=0) y=y*10+m%10; _1_ if(n=0) return y; else _2_ void main() / m=m/10 8 / return -y ; printf(%ldt,f(12345); printf(%ldn,f(-34567); _ 5 _ _u(Qep ffiNW&N2N-R -dbg vepWW&0_ #include #include #inclu

4、de void f(char *s) int i=0; while(si!=0) if(isdigit(si) _1_(s+i,s+i+1); / strcpy _2_ i+; void main() char str80; gets(str); f(str); puts(str); / else _ 6 _ _u( find QepW(彄QevW&N2N-gbf/T&Qsthe徺N*SU嬐0_YggR0徳VQsvk!epfiYg g*bR0徳V00_ #include int find(char *str) char *fstr=the; int i=0,j,n=0; while (stri

5、!=0) for(_1_) / j=0; j=3 _ 7 _ 彄QevN_N*,QWkfi_Wk_sTffiy #include void main() char c; c=getchar(); if(_1_) c=c+5; else if (c=v & c=a&c=u / c=(c-a+5)%26+a; _ 8 _ _W&N2 s N-bg vW&cR -d0_ #include void main() char s80; int i,j; gets(s); for(i=j=0; _1_; i+) if(si != c) sj=si; _2_ sj=0; puts(s); / si != 0

6、 / j+; _ 9 _ x=1fi 2fi 厖fi 10filB f(x)=x*x-5*x+sin(x)vg_YP0_ #include #include #define f(x) x*x-5*x+sin(x) 3 of 25 4/21/2010 void main() int x; float max; _1_ for(x=2;xmax) max=f(x); _ 10 _彄QeN N*etepfic u1,R0Yvz弿Q徺N N*ep0_ #include void swap(_1_) /*NcbN$N*epvOMn*/ int temp; temp = *pa; *pa = *pb; *

7、pb = temp; void main() int a,b,c,temp; scanf(%d%d%d,&a,&b,&c); if(ab) swap(&a,&b); if(bc) swap(&b,&c); if(_2_) swap(&a,&b); printf(%d,%d,%d,a,b,c); / int *pa, int *pb / if ( ab ) _ 11 _u(Qep ffiS粬depN-v_epfi彄Qeep x7fi彄QgN:7 1 3 4 6 #include void f(int *a,int *m) int i, j ; for(i=0;i*m;i+) if(ai0) /

8、epQC vR -d for(j=i-;j*m-1;j+) aj=aj+1; _1_; / *m = *m-1; void main() int i,n=7,x7=1,-2,3,4,-5,6,-7; _2_; for(i=0;in;i+) printf(%5d,xi); printf(n); / f (x, &n) ; 4 of 25 4/21/2010 _ 12 _u(Qep f 嫛NepY7y_, 1.1+2.2*x+3.3*x*x+4.4*x*x*x+5.5*x*x*x*x _S x=1.7 evP0_ #include float f(float, float*, int); void

9、 main() float b5=1.1, 2.2, 3.3, 4.4, 5.5 ; printf(%fn, f(1.7,b,5) ); float f( _1_ ) float y=a0, t=1; int i; for(i=1; in; i+) t=t*x; y=y+ai*t; _2_ / float x, float *a, int n / return y; _ 13 _R_R+邒W&N2N-傫eWk0_epW0_TQvNW&Qsvk!ep0_ #include #include void main() char a80; int n3=0, i; gets(a) ; _1_ / fo

10、r ( i=0; ai!=0; i+) if (tolower(ai)=a & tolower(ai)=z) /*邒WkN*ep*/ n0+; else if (_2_) /*邒epWN*ep*/ n1+; else n2+; for(i=0;i=0 & ai=9 _ 14 _彄QevSA徾R6etep _OY7彄QeSA徾R6ep # include # include char trans(int x) n 7徢Qep DtoH QeplcbN:SAQm徾R6epfiv_lcbgNW&N2_b_,彄Q0_ 79fi_彄QSAQm徾R6 4f0_ if(x10) return 0+x; el

11、se _1_ int DtoH(int n,char *str) int i=0; while(n!=0) / return a+x-10; 5 of 25 4/21/2010 _2_ n/=16;i+; return i-1; void main() int i,k,n; char *str; scanf(%d,&n); k=DtoH(n,str); / stri=trans(n%16); / la,7槝vg 6_ str f/c_c_攬0_e9N:7 char str80; for (i=0;i=k;i+) printf(%c,strk-i); _ 15 _彄QevSA徾R6kcetep

12、#include void Dec2Bin(int m) int bin32,j; for(j=0;m!=0;j+) n 7徢Qep Dec2Bin lcbN:N徾R6epfiv_lcbg湉Q0_ binj= _1_; m=m/2; for( ; j!=0; j- ) printf(%d, _2_ ); void main() int n; scanf(%d,&n); Dec2Bin(n); / m%2 / binj-1 _ 16 _epR4v, 10_ 2 yWGN:1fikdTffiT_yPWGN:嬪yRMN寴yNKT0_嫛epR4, 30 yvP0_ #include _1_ void

13、main() printf(%ldn,f(30) ; / long f(int n); b3_ long f(int); long f(int n) if( _2_ ) return 1; else / n=1 | n=2 6 of 25 4/21/2010 return f(n-1)+f(n-2); _ 17 _嬪zff弸VOMfu_vsWGb-fiOXW(gN-fiq6TffiR4h彄Q徺Nfu_vOo0_ #include struct STUDENT char name16; int math; int english; int computer; int average; ; voi

14、d GetAverage(struct STUDENT *pst) int sum=0; sum = _1_; pst-average = sum/3; /* 嫛sWGb- */ / pst-math+pst-english+pst-computer void main() int i; struct STUDENT st4=Jessica,98,95,90,Mike,80,80,90, Linda,87,76,70,Peter,90,100,99; for(i=0;i4;i+) GetAverage(_2_); / st + i printf(NametMathtEnglishtComput

15、Averagen); for(i=0;i4;i+) printf(%st%dt%dt%dt%dn,sti.name,sti.math,sti.english, puter,sti.average); _ 18 _彄Qe m0_ n_墎lB彄QeepWGYN 0 0_彄QNvg_YQlep0_ #include void main() int m, n, k; while ( scanf(%d%d, &m, &n), _1_ ); for (_2_ ; n%k!=0 | m%k!=0 ; k-) ; printf(%dn, k); / m=0|nn?n:m _ 19 _lBQ a N-T_v鴲N

16、$N*QC vTfiv_徺NTXeW(ep b N-fic k蠄L 3 N*QC v_b_,彄Q0_OY7 b1=a0+a1fi fi b9=a8+a90_ #include void main() 7 of 25 4/21/2010 int a10,b10,i; printf(nInput 10 numbers: ); for (i=0; i10;i+) scanf(%d, &ai); for (i=1; i10; i+) bi=_1_; for (i=1; i0 filB m O_2 v m k!e,Nb3IN nfi 2 v m+1 k!eYNb3IN n0_ #include void

17、 main() int m=0,t=1,n; while( _ 1 _); while(!(t=n) _ 2 _ m+; printf(%dn,m); / scanf(%d,&n), n=0 / 4S鲌h従_, / t=t*2; N0_zffe96_ _ 1 _ 彄QeN_N*W&N2fi_b-W&N2vbg 傫eWkvW&R -dTffi彄Q0_ #include #include void main() char str256; int i,j,k=0,n; gets(str); n=strlen(str); for(i=0;in;i+) / la,7槝vg 6_XR N_L7 #incl

18、ude /*1*/ if (tolower(stri)z) / if (tolower(stri)=a & tolower(stri)R0W&N2 _弿cR0W&N2 #include #include t Tffib0_OY7彄Qe t N-fiQ_W&N2N-vW&c ABCDfiR6W&N2 t N:ABCDDCBA0_ void fun(char *s,char *t) int i,sl; sl=strlen(s); for(i=0;isl;i+) ti=si; for(i=0;isl;i+) /*1*/ tsl+i=ssl-i; /*2*/ tsl=0; void main() ch

19、ar s100,t100; scanf(%s,s); fun(s,t); printf(%s,t); / tsl+i=ssl-1-i; / tsl+i =0; _ 3 _ 徯Le鰪Qe 10 N*epfiq6TffiR_R+彄QQvN-vg_YP0_g_,P0_ #include void main() float x,max,min; int i; /* 1 */ for(i=0;imax) max=x; if(xmin) min=x; printf(%f,%fn,max,min); / for(i=1; i=10; i+) / if(i=1) max=x;min=x; _ 4 _ u( b

20、l 10 N*etepc SGc0_ #include #define N 10 void main() int i, j, min, temp ; int aN=5, 4, 3, 2, 1, 9, 8, 7, 6, 0 ; 9 of 25 4/21/2010 printf(nThe array is:n); /* 彄QepQC */ for (i=0;iN;i+) printf(%5d,ai); for (i=0;iN-1;i+) min = i; for (j=i+1; jN; j+) /* 1 */ /* cdO */ if (aminaj ) min =j; temp=amin; amin=aj; aj=temp; / e9b- /*epcnNcb*/ temp=amin; amin=ai; ai=temp; printf(nThe sorted numbers: n); /* 彄Qcg for (i=0;iN;i+) printf(%5d,a

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1