想按平均值排序的,加了以后出错了,请指教下怎么改
#include<stdio.h>struct student
{
int ave;
int num;
char name[20];
int score1;
int score2;
int score3;
}student[3];
int main()
{
int i,j;
struct student temp;
int ave[3];
for(i=0;i<3;i++)
{
printf("请输入学生%d的资料:\n",i+1);
printf("学号为:");
scanf("%d",&student[i].num);
printf("姓名是:");
scanf("%s",&student[i].name);
printf("第一门成绩是:");
scanf("%d",&student[i].score1);
printf("第二门成绩是:");
scanf("%d",&student[i].score2 );
printf("第三们成绩是:");
scanf("%d",&student[i].score3 );
printf("\n");
student[i].ave =(student[i].score1 +student[i].score2 +student[i].score3 )/3 ;
}
printf("学号\t姓名\t语文\t数学\t英语平均分\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;i++)
{
if(student[j].ave <student[i].ave)
{
temp = student[j] ;
student[j] = student[i];
student[i] = temp;
}
}
}
for(i=0;i<3;i++)
{
printf("%d\t",student[i].num);
printf("%s\t",student[i].name );
printf("%d\t",student[i].score1 );
printf("%d\t",student[i].score2 );
printf("%d\t",student[i].score3 );
printf("%d\t",student[i].ave );
printf("\n=*=*=*=*=*=*=*=*+*+*+*+*+*+*\n");
}
}