[0] Zhang 85 s[Li7790 void main( A struct student s 301; s[29[ wang 60 78 Int for(i=0;i<30;计++){ scanf(%os%d%od",si] name, &s]. math, &si. eng s].aver=(sl]. math+s1]. eng)/2.0 printf("%s%f,sli] name, si aver)
void main( ) { struct student s[30]; int i; for(i=0; i<30; i++) { scanf("%s%d%d", s[i].name, &s[i].math, &s[i].eng); s[i].aver = (s[i].math+s[i].eng)/2.0 printf("%s%f", s[i].name, s[i].aver); } } s[0] s[29] s[1] Zhang 80 85 Li 77 90 wang 60 78
例2 输入某班30位学生的姓名及数学、英语成绩, 计算并输出每门课程的平均分 void maino i struct student s301 float aver m=0. aver e=0
输入某班30位学生的姓名及数学、英语成绩, 计算并输出每门课程的平均分。 void main( ) { struct student s[30]; int i; float aver_m=0, aver_e=0; 例2