[求助]用冒泡法按总评分排名次
还是上次那个问题 下面的程序怎样才能用冒泡排序排出按总成绩排名次 我想了都2天了 可是就是排不出来 请帮一下忙吧 只排最后的巨型显示的就行 谢谢啊#include <stdio.h>
#define N 3
struct student
{ char num[6];
char name[8];
int score[3];
double total;
}
stu[N];
void main()
{ int i,j,sum;
for(i=0;i<N;i++)
{ printf("\n please input NO.%d score:\n",i+1);
printf("stuNO.:");
scanf("%s",stu[i].num);
printf("name:");
scanf("%s",stu[i].name);
sum=0;
printf("score 1 shuxuechengji\t score 2 jisuanjichengji\t score 3 yingyuchengji\n");
for(j=0;j<3;j++)
{ printf("%d",j+1);
scanf("%d",&stu[i].score[j]);
sum+=stu[i].score[j];
}
stu[i].total=sum;
printf("zongchengjiwei:%g\n",stu[i].total);
if(stu[i].total>=270)
printf("you");
else if(stu[i].total>=180)
printf("jige");
else printf("bujige");
}
{int i,j;
printf("\n===================cheng ji biao============================");
printf("\n NO. name score1 score2 score3 zongchengji pingyu\n");
for(i=0;i<N;i++)
{printf("%4s%6s",stu[i].num,stu[i].name);
for(j=0;j<3;j++)
printf("%9d",stu[i].score[j]);
printf("%9g",stu[i].total);
printf(" ");
if(stu[i].total>=270)
printf("you");
else if(stu[i].total>=180)
printf("jige");
else printf("bujige");
printf("\n");
printf("************************************************************");
printf("\n");
}
}
}