#include
#define N 1024
typedef struct node
{
int sno;
int course1;
int course2;
int course3;
int course4;
int aver;
}student;
void main()
{
int i,j,number;
int total1,total2,total3,total4;
total1=total2=total3=total4=0;
student st[N],temp;
printf("Please input the student's number:");
scanf("%d",&number);
if(number>1024)
{
printf("The number is too large!\n");
exit(0);
}
for(i=0;i
printf("Please input the %dth student's sno:",i+1);
scanf("%d",&st[i].sno);
printf("Please input the %d's student's course1:",st[i].sno);
scanf("%d",&st[i].course1);
printf("Please input the %d's student's course2:",st[i].sno);
scanf("%d",&st[i].course2);
printf("Please input the %d's student's course3:",st[i].sno);
scanf("%d",&st[i].course3);
printf("Please input the %d's student's course4:",st[i].sno);
scanf("%d",&st[i].course4);
st[i].aver=(st[i].course1+st[i].course2+st[i].course3+st[i].course4)/4;
}
for(i=0;i
for(i=0;i
total1+=st[i].course1;
total2+=st[i].course2;
total3+=st[i].course3;
total4+=st[i].course4;
}
total1/=number;
total2/=number;
total3/=number;
total4/=number;
printf("The averscore of course1 is:%d\n",total1);
printf("The averscore of course2 is:%d\n",total2);
printf("The averscore of course3 is:%d\n",total3);
printf("The averscore of course4 is:%d\n",total4);
for(i=0;i
temp=st[i];
st[i]=st[j];
st[j]=temp;
}
printf("The list of the student's course:\n");
printf("==========\n");
for(i=0;i
printf("%d.",i+1);
printf("%dth student:%d\n",st[i].sno,st[i].aver);
}
谢谢了