#include
struct student
{
int num;
char name[20];
double score[2];
double aver;
};
void main()
{
void aver(struct student stu[]);
struct student max(struct student stu[]);
void print(struct student stur);
struct student stu[3];
aver(stu);
print(max(stu));
}
void aver(struct student stu[])
{
for (int i=0;i<=2;i++)
{
scanf("%d,%s,%f,%f",&stu[i].num ,stu[i].name ,&stu[i].score[0],&stu[i].score[1]);
stu[i].aver =(stu[i].score[0]+stu[i].score[1])/2.0;
}
}
struct student max(struct student stu[])
{
for (int j=0;j<=1;j++)
{
if(stu[j].aver>stu[j+1].aver )
stu[j+1]=stu[j];
}
return stu[2];
}
void print(struct student stur)
{
printf("%d,%s,%1f,%1f,%1f\n",stur.num,stur.name,stur.score[0],stur.score[1],stur.aver);
}
这个程序我之前的写过,你看一下你在函数调用的时候有没有出错。