用结构体存放n个学生的信息用选择法排序运行后什么都不显示
c语言程序设计中的302页的题 用结构体存放n个学生的信息用选择法排序。我照抄了用pelles C 运行后什么都不显示。改用别的编译系统就显示正确。这是为啥
程序代码:#include <stdio.h>
#include <string.h>
struct Student
{int num;
char name [20];
float score;
};
int main ()
{struct Student stu[5]={{10101,"zhang",78,},{10103,"wang",98.5},{10106,"li",86},{10108,"ling",73.5},{10110,"sun",100}};
struct Student temp;
const int n=5;
int i,j,k;
printf("the order is:\n");
for(i=0;i<n-1;i++)
{k=i;
for (j=i+1;j<n;j++)
if(stu[j].score>stu[k].score) //进行成绩比较
k=j;
temp =stu[k]; //stu【k】与stu【i】元素互换
stu[k]=stu[i];
stu[i]=temp;
}
for (i=0;i<n;i++)
printf("%6d%8s%6.2f\n",stu[i].num,stu[i].name,stu[i].score);
printf("\n");
return 0;
}







