请C语言的高手帮我一个大忙!错误已用括号标明
#include "stdio.h" #define N 10
struct student
{char num[10];
char name[20];
float score[3];
float sum;
float aver;
}stu[N];
void main()
{
void count(struct student stu[]);
void sort(struct student stu[]);
void find(struct student stu[]);
int i;
float temp;
for(i=0;i<N;i++)
{printf("enter data of the %dth student:\n",i+1);
printf("number: ");
gets(stu[i].num);
printf("name: ");
gets(stu[i].name);
printf("score1: ");
scanf("%f",&temp);
stu[i].score[0]=temp;
printf("score2: ");
scanf("%f",&temp);
stu[i].score[1]=temp;
printf("score3: ");
scanf("%f",&temp);
getchar();
stu[i].score[2]=temp;
}
count(stu);
printf("\n");
sort(stu);
printf("\n");
find(stu);
}
void count(struct student stu[])
{float sum,aver;
int i,j;
for(i=0;i<N;i++)
{sum=0;
for(j=0;j<3;j++)
sum+=stu[i].score[j];
aver=sum/3.0;
stu[i].sum=sum;
stu[i].aver=aver;
}
printf("number name sum average \n");
for(i=0;i<N;i++)
if(strcmp(nameornum,"num")==0) ( 错误)
{
r=l->next;
while(r!=NULL)
{
if(strcmp(r->data.num,findmess)==0)
return r;
r=r->next;
}
}
else if(strcmp(nameornum,"name")==0)
{
r=l->next;
while(r!=NULL)
{
if(strcmp(r->data.name,findmess)==0)
return r;
r=r->next;
}
}
return 0;
} ( 错误)
void sort(struct student stu[])
{int i,j,k;
struct student temp;
for(i=0;i<N;i++)
{k=i;
for(j=i+1;j<N;j++)
if(stu[k].sum<stu[j].sum)k=j;
if(k!=i)
{temp=stu[i];
stu[i]=stu[k];
stu[k]=temp;}
}
printf("number name score1 score2 score3 sum average \n");
for(i=0;i<N;i++)
printf("%-8s%-10s%-8.2f%-8.2f%-8.2f%-8.2f%-8.2f\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2],stu[i].sum,stu[i].aver);
}
} ( 错误)
printf("%-8s%-10s%-9.2f%-9.2f\n",stu[i].num,stu[i].name,stu[i].sum,stu[i].aver)
} ( 错误)