结构数组排序的有关问题

结构数组排序的问题
struct   student
{
char   Name[20];
float   Score;
}std[3];


void   main()
{
int   i=0;
for(i=0;   i <3;   i++)
{
printf( "请输入姓名:\n ",i+1);
scanf( "%s ",&std[i].stdName);
printf( "请输入成绩:\n ",i+1);
scanf( "%f ",&std[i].stdScore);
fflush(stdin);
}
printf( "Name\tScore\n ");
for(i=0;i <3;i++)
{
printf( "%s\t%f\n ",std[i].stdName,std[i].stdScore);

}
}
请问怎么样才能按成绩从高到低打印出来

------解决方案--------------------
//冒泡排序
for (int i = 0; i < n - 1); i++
{
for (int j = i +1; j < n; j++)
{
if (std[i].Score < std[j].Score)
{
char strTemp[50];
strcpy(strTemp, std[i].Name);
float m = std[i].Score;
strcpy(std[i].Name, std[j].Name);
std[i].Score = std[j].Score;
strcpy(std[j].Name, strTemp);
std[j].Score = m;
}
}
}
------解决方案--------------------
struct student tmp;
int i, j;
...
for(i=0; i <2; i++) //进行排序
for(j=1+1; j <3; j++)
{
if(std[i].Score < std[j].Score)
{tmp=std[i]; std[i]=std[j]; std[j]=tmp;}
}
for(i=0;i <3;i++) //OK, 可以输出了
{
printf( "%s\t%f\n ",std[i].Name,std[i].Score);
}