题目内容:
n个人的成绩存放在score数组中,请编写函数proc(),它的功能是将低于平均分的人数作为函数值返回,将低于平均分的分数放在cown所指的数组中。例如,当score数组中的数据为{99,80,40,56,59,84,60,76,100)时,函数返回的人数应该是4,down中的数据应为40 56 59 60。
注意:部分源程宇给出如下。 .
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。
试题程序:
#include<stdlib.h>
#include<corio.h>
#include<stdio.h>
#include<string.h>
int proc(int score[],int n,int down[])
{ }
void main()
{
int i,n,down[9];
int score[9]={99,80,40,56,59,84,
60,76,100};
system("CLS"):
n=proc(Score,9,down);
printf("\nd 3wn to the average score are:");
for(i=0;i<n;i++)
printf("%d",down[i]);
printf("\n"); }
参考答案:【答案仅供学习,请勿对照自行用药等】
答案解析: