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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

计算机二级C真题附答案后面.docx

1、计算机二级C真题附答案后面二级C语言上机考试复习资料(共60套题目)第1套1、程序填空题 #include void fun(char *s, int *t) int i, n; n=0;/*found*/ for(i=0; _1_ !=0; i+)/*found*/ if(si=0&si= _2_ ) n+;/*found*/ _3_ ;main() char s80=abcdef35adgh3kjsdf7; int t; printf(nThe original string is : %sn,s); fun(s,&t); printf(nThe result is : %dn,t);2、

2、程序修改题#include int fun(int *x,int y) int t ;/*found*/ t = x ; x = y ;/*found*/ return(y) ;main() int a = 3, b = 8 ; printf(%d %dn, a, b) ; b = fun(&a, b) ; printf(%d %dn, a, b) ;3、程序设计题#include void fun (int *a, int *n)main( ) int aa1000, n, k ; fun ( aa, &n ) ; for ( k = 0 ; k n ; k+ ) if(k + 1) % 1

3、0 = 0) printf(n) ; else printf(%5d, aak) ;第2套 1、程序填空题 #include void fun(char *s, char *p) int i, j, n, x, t; n=0; for(i=0; si!=0; i+) n+; for(i=1; in-2; i=i+2) /*found*/ _1_;/*found*/ for(j=_2_+2 ; jsj) t=j; if(t!=i) x=si; si=st; st=x; for(i=1,j=0; in; i=i+2, j+) pj=si;/*found*/ pj=_3_;main() char s

4、80=baawrskjghzlicda, p50; printf(nThe original string is : %sn,s); fun(s,p); printf(nThe result is : %sn,p);2、程序修改题#include #include float fun ( float num ) int s ; float n, t, pi ; t = 1 ; pi = 0 ; n = 1 ; s = 1 ;/*found*/ while(t = num) pi = pi + t ; n = n + 2 ; s = -s ;/*found*/ t = s % n ; pi =

5、pi * 4 ; return pi ;main( ) float n1, n2 ; printf(Enter a float number: ) ; scanf(%f, &n1) ; n2 = fun(n1) ; printf(%6.4fn, n2) ;3、程序设计题#include #include #define LEN 20void fun (char a, char b, int n)main( ) char str1LEN, str2LEN ; int n ; printf(Enter the string:n) ; gets(str1) ; printf(Enter the in

6、dex of the char deleted:) ; scanf(%d, &n) ; fun(str1, str2, n) ; printf(The new string is: %sn, str2) ;第3套1、程序填空题 #include #include #define N 5typedef struct node int data; struct node *next; NODE;void fun(NODE *h) NODE *p, *q, *r;/*found*/ p = h-_1_;/*found*/ if (p=_2_) return; q = p-next; p-next =

7、 NULL; while (q) r = q-next; q-next = p;/*found*/ p = q; q = _3_; h-next = p;NODE *creatlist(int a) NODE *h,*p,*q; int i; h = (NODE *)malloc(sizeof(NODE); h-next = NULL; for(i=0; idata=ai; q-next = NULL; if (h-next = NULL) h-next = p = q; else p-next = q; p = q; return h;void outlist(NODE *h) NODE *

8、p; p = h-next; if (p=NULL) printf(The list is NULL!n); else printf(nHead ); do printf(-%d, p-data); p=p-next; while(p!=NULL); printf(-Endn); main() NODE *head; int aN=2,4,6,8,10; head=creatlist(a); printf(nThe original list:n); outlist(head); fun(head); printf(nThe list after inverting :n); outlist(

9、head);2、程序修改题#include #include #define N 80int fun(char *s, char *t) int n; char *p , *r; n=0; while ( *s ) p=s;/*found*/ r=p; while(*r) if(*r=*p) r+; p+; else break;/*found*/ if(*r= 0) n+; s+; return n;main() char aN,bN; int m; printf(nPlease enter string a : ); gets(a); printf(nPlease enter substr

10、ing b : ); gets( b ); m=fun(a, b); printf(nThe result is : m = %dn,m);3、程序设计题#include #include #define M 3#define N 20void fun(char aMN, char *b) /* 以下代码仅供参考 */ int i; *b=0;main() char wMN=AAAA,BBBBBBB,CC, a100; printf(The string:n); for(i=0; iM; i+)puts(wi); printf(n); fun(w,a); printf(The A string

11、:n); printf(%s,a);printf(nn);第4套1、程序填空题 #include #define N 4void fun(int (*t)N) int i, j, x;/*found*/ for(i=0; i=1; j-) tij=tij-1;/*found*/ ti_3_=x; main() int tN=21,12,13,24,25,16,47,38,29,11,32,54,42,21,33,10, i, j; printf(The original array:n); for(i=0; iN; i+) for(j=0; jN; j+) printf(%2d ,tij);

12、printf(n); fun(t); printf(nThe result is:n); for(i=0; iN; i+) for(j=0; jN; j+) printf(%2d ,tij); printf(n); 2、程序修改题#include double fun( double q ) int n; double s,t; n = 2; s = 2.0; while (s=q) t=s;/*found*/ s=s+(n+1)/n; n+; printf(n=%dn,n);/*found*/ return s;main ( ) printf(%fn, fun(50);3、程序设计题#inc

13、lude #include int fun( int t)main() /* 主函数 */ int n; n=1000; printf(n = %d, f = %dn,n, fun(n);第5套1、程序填空题 #include #include #include int fun(char *s) char *lp,*rp;/*found*/ lp= _1_ ; rp=s+strlen(s)-1; while(toupper(*lp)=toupper(*rp) & (lprp) ) /*found*/ lp+; rp _2_ ; /*found*/ if(lprp) _3_ ; else ret

14、urn 1;main() char s81; printf(Enter a string: ); scanf(%s,s); if(fun(s) printf(n%s is a Palindrome.nn,s); else printf(n%s isnt a Palindrome.nn,s);2、程序修改题#include /*found*/fun (int n ) int a = 2, b = 1, c, k ; double s=0.0 ; for ( k = 1; k = n; k+ ) s = s + 1.0 * a / b ;/*found*/ c = a; a += b; b +=

15、c; return(s) ;main( ) int n = 5 ; printf( nThe value of function is: %lfn, fun ( n ) ) ;3、程序设计题#include void fun(int m, int k, int xx) /* 以下代码仅供参考 */ int i, j=1, t=m+1; while(j=k) /* 以下完成判断素数,并存放到数组xx中 */ main() printf( nPlease enter two integers:) ; scanf(%d%d, &m, &n ) ; fun( m, n, zz) ; for( m =

16、0 ; m n ; m+ ) printf(%d , zzm) ; printf(n) ;第6套 1、程序填空题#include #include double fun(double x) double f, t; int n; f = 1.0 + x;/*found*/ t = _1_; n = 1; do n+;/*found*/ t *= (-1.0)*x/_2_; f += t; /*found*/ while (_3_ = 1e-6); return f;main() double x, y; x=2.5; y = fun(x); printf(nThe result is :n);

17、 printf(x=%-12.6f y=%-12.6fn, x, y);2、程序修改题#include long fun(int x,int y,long *p ) int i; long t=1;/*found*/ for(i=1; iy; i+) t=t*x; *p=t;/*found*/ t=t/1000; return t;main() long t,r; int x,y; printf(nInput x and y: ); scanf(%ld%ld,&x,&y); t=fun(x,y,&r); printf(nnx=%d, y=%d, r=%ld, last=%ldnn,x, y,r

18、,t );3、程序设计题#include #include double fun(double x)main() double x,s; printf(Input x: ); scanf(%lf,&x); s=fun(x); printf(s=%fn,s);第7套1、程序填空题 #include int c1,c2,c3;void fun(long n) c1 = c2 = c3 = 0; while (n) /*found*/ switch(_1_) /*found*/ case 1: c1+;_2_;/*found*/ case 2: c2+;_3_; case 3: c3+; n /=

19、10; main() long n=123114350L; fun(n); printf(nThe result :n); printf(n=%ld c1=%d c2=%d c3=%dn,n,c1,c2,c3);2、程序修改题#include int fun(unsigned n, int *zero) int count=0,max=0,t; do t=n%10;/*found*/ if(t=0) count+; if(maxt) max=t; n=n/10; while(n);/*found*/ zero=count; return max;main() unsigned n; int z

20、ero,max; printf(nInput n(unsigned): ); scanf(%d,&n); max = fun( n,&zero ); printf(nThe result: max=%d zero=%dn,max,zero);3、程序设计题 #include double fun(int n)main() int n; double s; printf(nInput n: ); scanf(%d,&n); s=fun(n); printf(nns=%fnn,s);第8套 1、程序填空题 #include unsigned long fun(unsigned long n) un

21、signed long x=0; int t; while(n) t=n%10;/*found*/ if(t%2=_1_)/*found*/ x=_2_+t;/*found*/ n=_3_; return x;main() unsigned long n=-1; while(n99999999|n0) printf(Please input(0n100000000): ); scanf(%ld,&n); printf(nThe result is: %ldn,fun(n);2、程序修改题 #include void fun (long s, long *t) int d; long sl=1;

22、/*found*/ t = 0; while ( s 0) d = s%10;/*found*/ if (d%2 = 0) *t = d * sl + *t; sl *= 10; s /= 10; main() long s, t; printf(nPlease enter s:); scanf(%ld, &s); fun(s, &t); printf(The result is: %ldn, t);3、程序设计题 #include void fun(char p1, char p2)main() printf(Enter s1 and s2:n) ; scanf(%s%s, s1, s2) ; printf(s1=%sn, s1) ; printf(s2=%sn, s2) ; printf(Invoke fun(s1,s2):n) ; fun(s1, s2) ; printf(After invoking:n) ; printf(%sn, s1) ;第9套 1、程序填空题 #include #define M 3#define N 4void fun(int (*a)N) int i=0,j,find=0,rmax,c,k; while( (iM) & (!find) rmax=ai0; c=0; for(j=1; jN; j+) if(rmax

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

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