此程序要如何改才能实现功能
#include<stdio.h>struct student
{
char name[99];
double score;
};
int reorder(struct student a[])
{
struct student d[5];
int i,j,k,c[5]={0,1,2,3,4};
double temp;
for(i=0;i<5;i++)
{
d[i].name=a[i].name;//<==此处有问题
d[i].score=a[i].score;
}
for(k=0,i=0;i<5;i++,k++)
for(j=i+1;j<5;j++)
{
if(a[i].score>a[j].score)
{
temp=a[i].score;
a[i].score=a[j].score;
a[j].score=temp;
c[k]=j;
}
}
printf("按成绩降序排序为:\n");
printf("name score\n");
for(k=0;k<5;k++)
printf("%-7s%.1lf\n",d[c[k]].name,d[c[k]].score);
return 0;
}
int main()
{
struct student b[5];
printf("请输入学生的姓名和成绩:\n");
for(int i=0;i<5;i++)
scanf("%s %lf",&b[i].name,&b[i].score);
reorder(b);
return 0;
}