主题:这个c++程序不能运行 请大家帮帮忙
输入N个学生学号及5门课成绩然后按成分从高到低输出
#include<stdio.h>
#define N 10
void main()
{
struct student
{int num;
float score[5];};
struct student stu[N];
int n,m,i,j,tn;
float sum[N],t,ts;
for(n=0;n<N;i++)
{printf("No.:");
scanf("%d",&stu[n].num);
printf("input scores of student %d:\n",n+1);
for(m=0;m<5;m++)
scanf("%f",&stu[n].score[m]);
}
for(n=0;n<N;i++)
for(m=0;m<5;m++)
sum[n]=stu[n].score[0]+stu[n].score[1]+stu[n].score[2]+stu[n].score[3]+stu[n].score[4];
for(j=1;j<N;j++)
for(i=1;i<N-j;i++)
if(sum[i-1]>sum[i])
{t=sum[i-1];
sum[i-1]=sum[i];
sum[i]=t;
tn=stu[i-1].num;
stu[i-1].num=stu[i].num;
stu[i].num=tn;
for(m=0;m<5;m++)
{ts=stu[i-1].score[m];
stu[i-1].score[m]=stu[i].score[m];
stu[i].score[m]=ts;}
}
printf("No. sum score1 score2 score3 score4 score5\n");
for(i=1;i<=N;i++)
{printf("%d %f",stu[i-1].num,sum[i-1]);
for(j=1;j<=5;j++)
printf("%f",stu[i-1].score[j-1]);}
}
#include<stdio.h>
#define N 10
void main()
{
struct student
{int num;
float score[5];};
struct student stu[N];
int n,m,i,j,tn;
float sum[N],t,ts;
for(n=0;n<N;i++)
{printf("No.:");
scanf("%d",&stu[n].num);
printf("input scores of student %d:\n",n+1);
for(m=0;m<5;m++)
scanf("%f",&stu[n].score[m]);
}
for(n=0;n<N;i++)
for(m=0;m<5;m++)
sum[n]=stu[n].score[0]+stu[n].score[1]+stu[n].score[2]+stu[n].score[3]+stu[n].score[4];
for(j=1;j<N;j++)
for(i=1;i<N-j;i++)
if(sum[i-1]>sum[i])
{t=sum[i-1];
sum[i-1]=sum[i];
sum[i]=t;
tn=stu[i-1].num;
stu[i-1].num=stu[i].num;
stu[i].num=tn;
for(m=0;m<5;m++)
{ts=stu[i-1].score[m];
stu[i-1].score[m]=stu[i].score[m];
stu[i].score[m]=ts;}
}
printf("No. sum score1 score2 score3 score4 score5\n");
for(i=1;i<=N;i++)
{printf("%d %f",stu[i-1].num,sum[i-1]);
for(j=1;j<=5;j++)
printf("%f",stu[i-1].score[j-1]);}
}