简单的程序,可是到底错那了,输不出来
#include"stdio.h"#define N 5
struct student
{long stu_num; char sex;
char name[15]; int score[4];
float average;
};
main()
{int I,j,k,t; float sum,max;
struct student stuarr[N];
printf("please input student information:\n");
for(I=0;I<=5;I++)
scanf("%ld,%c,%s",&stuarr[I].stu_num,&stuarr[I].sex,stuarr[I].name);
for(j=0;j<4;j++)
scanf("%d",&stuarr[I].score[j]);
for(sum=0,j=0;j<4;j++)
{sum+=stuarr[I].score[j];
stuarr[I].average=sum/4;
printf("%lf",stuarr[I].average);
}
max=stuarr[0].average;
for(I=1;I<=5;I++)
{if(stuarr[I].average>max)
max=stuarr[I].average;
}
printf("总平均成绩最高的学生信息是学号=%ld,性别=%c,姓名=%s,平均成绩=%4.1f\n",stuarr[I].stu_num,stuarr[I].sex,stuarr[I].name,stuarr[I].average);
}