pull/4/head
wuhangkai 2 years ago
parent 63d3b5e77b
commit 4ba7bfebc9

17
void

@ -14,20 +14,3 @@ void AverSumofEveryStudent(STU stu[], int n, int m)
i+1, stu[i].sum, stu[i].aver); 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]);
}
Loading…
Cancel
Save