在三个学生中输出平均成绩最高的学生信息,请问一下我程序的问题在哪里
#include <stdio.h>struct stu
{
int num;
char name[10];
float score[3];
float aver;
};
void input (struct stu st1[])
{
int i;
printf("please three stu number:\n");
for(i=0;i<3;i++)
{
scanf("%d,%s,%f,%f,%f",&st1[i].num,&st1[i].name,&st1[i].score[0],&st1[i].score[1],&st1[i].score[2]);
st1[i].aver=(st1[i].score[0]+st1[i].score[1]+st1[i].score[2])/3;
}
}
void max(struct stu st2[])
{
struct stu p;
int i,j;
input(st2);
for(j=0;j<2;j++)
{
for(i=0;i<3-j-1;i++)
{
if(st2[i].aver<st2[i+1].aver)
{
p=st2[i];
st2[i]=st2[i+1];
st2[i+1]=p;
}
}
}
printf("%d,%s,%f,%f,%f",st2[0].num,st2[0].name,st2[0].score[0],st2[0].score[1],st2[0].score[2]);
}
int main()
{
struct stu st[3],*p=st;
max(p);
return 0;