林子雨-C序期末考试题目讲解(2015年6月真题考卷B).pptVIP

  • 0
  • 0
  • 约2.37千字
  • 约 12页
  • 2016-12-08 发布于贵州
  • 举报

林子雨-C序期末考试题目讲解(2015年6月真题考卷B).ppt

林子雨-C序期末考试题目讲解(2015年6月真题考卷B)

《C程序设计基础》 期末考试题目讲解 (2011年6月真题考卷B) 内容提要 期末考试题目 阅读题(题目未找到) 改错题 第1题 第2题 编程题 第1题 第2题 第3题 第4题 改错题-第1题 //加密数字:对整数的各位数字在原数字基础上加5,如果超过9则除10取余。 //加密后的数字存储在数组中,最后输出数组各元素。 #includestdio.h void main() { int a,b[20],i,len; //len少了=0 scanf(%d,a); while(a) { b[len++]=(a%10+5)%10; a=a/10; //少了} len--; while(len=0); //多了; printf(%d,b[len--]); printf(\n); } 改错题-第2题 //power函数的功能是求X的k次方; //主函数的功能是求x的1至n次方之和。 #includestdio.h int power(float x,int k) //少了; void main() { int n,sum=0,i; float x; scanf(%f%d,x,n); for(i=1;i=n;i++); //多了; sum=sum+power(x,i); printf(%d\n,sum); } int power(float x,

文档评论(0)

1亿VIP精品文档

相关文档