当前位置: 代码迷 >> C语言 >> [求助]加上冒泡排序
  详细解决方案

[求助]加上冒泡排序

热度:403   发布时间:2006-06-19 17:41:25.0
[求助]加上冒泡排序
下面的程序在哪加上冒泡排序?怎么加 ? 我在main()函数里加上后为什么只排总成绩?其他的怎么不变啊? 急用
#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");
}
}
}
搜索更多相关的解决方案: 冒泡  

----------------解决方案--------------------------------------------------------

意思就是按总成绩排名次 我以后会认真学的 请大家先帮我一下啊 谢谢啊


----------------解决方案--------------------------------------------------------
在 printf("\n NO. name score1 score2 score3 zongchengji pingyu\n");后加上就可以
bubblsort(stu[]);
----------------解决方案--------------------------------------------------------

谢谢你啊 俺会点了


----------------解决方案--------------------------------------------------------
  相关解决方案