2013计算机等级考试二级C语言试题及答案15

全国等级考试资料网 2023-07-03 22:57:50 112
一、填空题
请补充main函数,该函数的功能是:计算每个学生科目的平均分,并把结果保存在数组bb中。
例如,当score[N][M]={{78.5,84,83,65,63},{88,91.5,89,93,95},{72.5,65,56,75,77}}时,三个学生的平均分为:74.7 91.3 69.1。
仅在横线上填入所编写的若干表达式或语句,勿改动函数中的其他任何内容。
#include
#define N 3
#define M 5
main()
{
int i, j;
static float score[N][M] =
{
{78.5, 84, 83, 65, 63},
{88, 91.5, 89, 93, 95},
{72.5, 65, 56, 75, 77}
};
float bb[N];
for (i=0; i___1___;
for (i=0; i{
for (j=0; j___2___;
bb[i] /= M;
}
for (i=0; iprintf(" student%d average=%5.1f", i+1, bb[i]);
}
参考答案:
1、bb[i]=0 或 *(bb+i)=0
2、bb[i]+=score[i][j] 或bb[i]=b[i]+score[i][j] 或bb[i]=score[i][j]+bb[i]首页 1 2 3 尾页 相关资料

相关阅读