历年上机练习系统部分程序改错题及答案.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《历年上机练习系统部分程序改错题及答案.doc》由会员分享,可在线阅读,更多相关《历年上机练习系统部分程序改错题及答案.doc(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流历年上机练习系统部分程序改错题及答案.精品文档.程序调试1、#include #include 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=ss1-1-i; tsl+i=ssl-i; /*2*/ tsl=0; / tsl+s1=0;void main() char s100,t100; scanf(%s,s); fun(s,t); printf(%s,t);2、#include vo
2、id main() int n,i; scanf(%d,&n); /* 1 */ i=1; / i=2; while(n1) if(n%i=0) printf(%dt,i); n/=i; else /* 2 */ n+; / i+;3、#include #include void main() int n,s=0; scanf(%d,&n); n=fabs(n); /* 1 */ while(n1) / 1n 2n!=0 s=s+n%10; /* 2 */ n=n%10; / n=n/10; printf(%dn,s);4、#include #include #include void mai
3、n() int i,n; /* 1 */ struct axy float x,y; a; /struct axy float x,y; *a; scanf(%d,&n); a=(float*) malloc(n*2*sizeof(float); for(i=0;in;i+) /* 2 */ scanf(%f%f,ai.x,ai.y);/ scanf(%f%f,&ai.x,&ai.y); for(i=0;in;i+) if(sqrt(ai.x*ai.x+ai.y*ai.y)=5) printf(%f,%fn,ai.x,ai.y);5、#includevoid itoa(long i,char
4、*s) if(i=0) return; /* 1 */ *s = 1+i%10; /*s = 0+i%10; itoa(i/10,s-1);void main() long n; char str7=; scanf(%ld,&n); /* 2 */ itoa(n,str+6); / itoa(n,str+5); printf(%s,str);6、#include #define N 10void main() int i,j,min,temp; int aN=5,4,3,2,1,9,8,7,6,0; printf(nThe array is:n); /* 输出数组元素 */ for (i=0;
5、iN;i+) printf(%5d,ai); for (i=0;iN-1;i+) /* 排序操作 */ min = i; for (j=i+1; jN; j+) /* 1 */ if (amin=aj) /* 2 */ temp=amin; amin=aj; aj=temp; /* 数据交换 */ temp=amin; amin=ai; ai=temp; printf(nThe sorted numbers: n); /* 输出排序结果 */ for (i=0;iN;i+) printf(%5d,ai); printf(n);7、#include void main() char s180,s
6、240; int i=0,j=0; printf(nInput the first string:); scanf(%s,s1); printf(nInput the second string:); scanf(%s,s2); while (s1i !=0) /* 1 */ i+1; / i= i+1; while (s2j !=0) /* 2 */ s1+i=s2+j; /* 拼接字符到s1 */ /s1i+=s2j+; s1i =0; printf(nNew string: %s,s1);8、#include void main() int i,a,n,t=0; /* 1 */ s=0;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 历年 上机 练习 系统 部分 程序 改错 答案
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内