计算机二级C语言试题整套.docVIP

  • 14
  • 1
  • 约45.2万字
  • 约 441页
  • 2018-03-29 发布于河南
  • 举报
计算机二级C语言试题整套

第三部分 编程题 1.m个人的成绩存放在score数组中,请编写函数fun,它的功能是:将低于平均分的人数作为函数值返回,将低于平均分的分数放在below所指的数组中。 例如,当score数组中的数据为10、20、30、40、50、60、70、80、90时,函数返回的人数应该是4,below中的数据应为10、20、30、40。 ???????????????????????????????????????????????????????????? #include string.h #include conio.h #include stdio.h /*第一个for()循环用来计算score数组中分数的总和,然后用aver/=m求出平均值,第二个循环用来找出小于平均分的元素,并放到数组below中,这里要注意j的递增方式。*/ int fun(int score[],int m, int below[]) { int i,j=0,aver=0; for(i=0;im;i++) aver+=score[i]; aver/=m; for(i=0;im;i++) if(score[i]aver) below[j++]=score[i]; return j; } main() { int i,n,below[9]; int score[9]={10,20,30,40,50,60,70,80

文档评论(0)

1亿VIP精品文档

相关文档