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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

本文(重庆理工大学C语言期末试题改错编程题.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

重庆理工大学C语言期末试题改错编程题.docx

1、重庆理工大学C语言期末试题改错编程题void fun(char *a,char *b,char *c) int i,j; char ch; i=0; j=strlen(b)-1;/*found*/ while (ij)这里大小写符号错了 ch=bi;bi=bj;bj=ch; i+; j-; while (*a|*b)/*found*/ if (*a) *c=*a;c+;a+;这里他的错误时if大写了 if (*b) *c=*b;c+;b+; *c=0; #include /*found*/float fun ( float r)这里要有r不能用x否则是错的/*found*/ return 3.

2、14159 *r*r /2.0; main ( ) float x; printf ( Enter x: );/*found*/ scanf ( %f, &x); printf ( s = %fn , fun ( x ) ); int fun(char *p)int n;/*found*/ n=*p-0; p+; while (*p!=0) /*found*/ n=n*8+*p-0; p+; return n; int fun(int k)int m=0,mc=0 ; while (k=2)&(mc=0; i-=2) if (i-1 = 0) tj+ = si-1; if (i-1 = 0)

3、tj+ = si-1; tj+ = si; tj+ = si; /*found*/ tj=0; main() char s100, t100; printf(nPlease enter string s:);/*found*/ scanf(%s, s); fun(s, t); printf(The result is: %sn, t); 答案:a=26,b=14,c=19void fun (char *s, char *t) int i, j, sl; sl = strlen(s); for(i=sl-1,j=0;i=0;i-=2) tj+ = si; if (i-1 = 0) tj+ = s

4、i-1; tj+ = si; if (i-1 = 0) tj+=si-1; tj = 0; main() char s100, t100; printf(nPlease enter string s:); scanf(%s, s); fun(s,t); printf(The result is: %sn, t); long ACK( long m, long n ) long k; if( m = 0 ) k = n + 1; else if( n = 0 ) k = ACK( m - 1, 1 ); else /*found*/ k = ACK( m - 1, ACK( m , n - 1

5、) ); return( k );main() long m, n; system(cls); printf( nPlease enter 2 numbers:n ); scanf( %ld %ld, &m, &n );/*found*/ printf( nThe value of Ackerman function is %dn, ACK( m, n ) ); double fun( double q ) int n; double s; n = 2; s = 2.0;/*found*/ while (s= q) s=s+(double)(n+1)/n;/*found*/ n+ ; prin

6、tf(n=%dn,n);/*found*/ return s ; main ( ) printf(%fn, fun(50); X=10, n=6int fun(int m) int k=2; while (k=m&(m%k)/*found*/ k+;/*found*/ if (m=k) return 1; else return 0;main()int n; system(cls); printf(nPlease enter n:);scanf( %d,&n); if (fun(n) printf(YESn); else printf(NO!n); int fun(int array33) i

7、nt i,j,arr33 ; memcpy(arr, array, 9*sizeof(int) ; for(i = 0 ; i 3 ; i+) for(j = 0 ; j 3 ; j+)/*found*/ arrayij = arrayij; main() int i,j; int array33=100,200,300, 400,500,600, 700,800,900; for (i=0;i3;i+) for (j=0;j3;j+) printf(%7d,arrayij); printf(n); /*found*/ fun(array33); printf(Converted array:

8、n); for (i=0;i3;i+) for (j=0;j3;j+)/*found*/ printf(%7d, arrayij); printf(n); double fun(int m) double t=1.0; int i; for(i=2;i=m;i+)/*found*/ t=1.0-1/i;/*found*/ _; #include void fun( int m, int k ) int aa20, i; for( i = 0; m; i+ ) aai = _1_; m /= _2_; for( ; i; i- ) printf( %d, _3_ i-1 );答案:0 #defi

9、ne N 10/*found*/void fun(int a,int m) int low=0,high=N-1,mid; while(low=high) mid=(low+high)/2; if(m=amid) low=mid+1; else return(mid); return(-1); main() int i,aN=-3,4,7,9,13,45,67,89,100,180,k,m; printf(a数组中的数据如下:); for(i=0;i=0) printf(m=%d,index=%dn,m,k); else printf(Not be found!n); #include voi

10、d fun(int a, int b, int n) int i;/*found*/ for (i=0; i6; i+) bi = _1_; for (i=0; i= 5000) b5+;/*found*/ _2_ bai/1000+; main() int i, a100= 900, 1800, 2700, 3800, 5900, 3300, 2400, 7500, 3800, b6; fun(a, b, 9); printf(The result is: );/*found*/ for (i=0; i6; i+) printf(%d , _3_); printf(n); fun(char

11、*p) int i,t;char c80;/*found*/ For (i=0,t=0;pi;i+) if(!isspace(*(p+i) ct+=pi;/*found*/ ct=0; strcpy(p,c); main()char c,s80; int i=0; printf(Input a string:); c=getchar(); while(c!=#) si=c;i+;c=getchar(); si=0; fun(s); puts(s); #define MAXLINE 20fun ( char *pstr6) int i, j ; char *p ; for (i = 0 ; i

12、5 ; i+ ) for (j = i + 1; j 0) p = *(pstr + i) ;/*found*/ pstri = _2_ ;/*found*/ *(pstr + j) = _3_ ; 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,&

13、r); printf(nnx=%d, y=%d, r=%ld, last=%ldnn,x, y,r,t );void fun (char *s, char *t, char *u) int i, j, sl, tl; sl = strlen(s); tl = strlen(t); for (i=0; isl; i+) for (j=0; jtl; j+) if (si = tj) break;/*found*/ if (j _1_ tl) *u+ = si; for (i=0; itl; i+) for (j=0; jsl; j+) if (ti = sj) break;/*found*/ i

14、f (j _2_ sl) *u+ = ti; /*found*/ _3_ = 0;main() char s100, t100, u100; printf(nPlease enter string s:); scanf(%s, s); printf(nPlease enter string t:); scanf(%s, t); fun(s, t, u); printf(The result is: %sn, u);#include /*found*/ fun(char *a) if(*a) fun(a+1) ;/*found*/ printf(%c, *a); main() char s10=

15、abcd; printf(处理前字符串=%sn处理后字符串=,s); fun(s);printf(n); #include void fun(int x, int pp, int *n) int i, j = 0 ; for(i = 1 ; i = x ; i +=2 )/*found*/ if(x % i) = 0) ppj+ =i;/*found*/ *n = j ; main() int x, aa1000, n, i ; printf( nPlease enter an integer number:n ) ; scanf(%d, &x) ;/*found*/ fun(x, aa,&n

16、 ) ; for( i = 0 ; i n ; i+ ) printf(%d , aai) ; printf(int fun(char *fname ) FILE *fp; int i,n; float x; if(fp=fopen(fname, w)=NULL) return 0; for(i=1;i=10;i+)/*found*/ fprintf(_1_,%d %fn,i,sqrt(double)i); printf(nSucceed!n);/*found*/ _2_; printf(nThe data in file :n);/*found*/ if(fp=fopen(_3_,r)=NU

17、LL) return 0; fscanf(fp,%d%f,&n,&x); while(!feof(fp) printf(%d %fn,n,x); fscanf(fp,%d%f,&n,&x); fclose(fp); return 1;main() char fname=myfile3.txt; fun(fname);long fun (long num)/*found*/ long k=1; do k*=num%10 ;/*found*/ num/=10 ; while(num) ; return (k) ; main( ) long n ; system(cls) ; printf(Plea

18、se enter a number:) ; scanf(%ld,&n) ; printf(n%ldn,fun(n) ;fun(char *s,int num5) int k,i=5; for (k=0;k=0) numi+; main()char s181; int num15,i; system(cls); printf(nPlease enter a string:);gets(s1); fun(s1,num1); for (i=0;i5;i+) printf(%d ,num1i);printf(n); void fun (char *s, char *t) int i,j,sl;/*fo

19、und*/ sl = strlen(s); for (i=0, j=0; isl; i+=2) if (i+1 sl) t2*j = si+1; t2*j +1 = si+1; j+; t2*j = si; t2*j +1 = si;/*found*/ j+; t2*sl = 0; main() char s100, t100; printf(nPlease enter string s:); scanf(%s, s);/*found*/ fun(s,t); printf(The result is: %sn, t); #include void fun(int a, int b, int n

20、) int i; for (i=0; i6; i+) bi = 0;/*found*/ for (i=0; i _1_; i+) if (ai 60) b5+;/*found*/ _2_ b(ai- 60)/10+; main() int i, a100= 93, 85, 77, 68, 59, 43, 94, 75, 98, b6;/*found*/ fun(_3_, 9); printf(the result is: ); for (i=0; i=0; i-=2) t2*j = si;/*found*/ t2*j +1 = si ; j+; t2*j=0; main() char s100, t100; printf(nPlease enter string s:); scanf(%s, s); fun(s, t); printf(The result i

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

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