p2pwza8cv 2 years ago
parent f78db4769a
commit 5823c67a60

12
z3

@ -0,0 +1,12 @@
// 3函数功能:计算每门课程的总分和平均分
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]);
}
* end --________ */
Loading…
Cancel
Save