|
|
|
@ -14,20 +14,3 @@ void AverSumofEveryStudent(STU stu[], int n, int m)
|
|
|
|
|
i+1, stu[i].sum, stu[i].aver);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 函数功能:计算每门课程的总分和平均分
|
|
|
|
|
void AverSumofEveryCourse(STU stu[], int n, int m)
|
|
|
|
|
{
|
|
|
|
|
int i, j;
|
|
|
|
|
float sum[COURSE_NUM], aver[COURSE_NUM];
|
|
|
|
|
/* ---------- begain ---------- */
|
|
|
|
|
for (j=0; j<m; j++)
|
|
|
|
|
{
|
|
|
|
|
sum[j] = 0;
|
|
|
|
|
for (i=0; i<n; i++)
|
|
|
|
|
{
|
|
|
|
|
sum[j] += stu[i].score[j];
|
|
|
|
|
}
|
|
|
|
|
aver[j]=sum[j]/i;
|
|
|
|
|
printf("student %d: sum = %.0f, aver = %.0f\n",
|
|
|
|
|
j+1, sum[j], aver[j]);
|
|
|
|
|
}
|