发布网友 发布时间:2024-10-24 17:26
共1个回答
热心网友 时间:2024-11-06 08:30
#include <stdio.h>
struct Student
{
int num;
double score;
};
main()
{
struct Student stu[3]={{11,12.4},{95,11.1},{41,13.4}};
struct Student temp;
int i,j;
for(j=0;j<3;j++)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
for(i=0;i<2-j;i++)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
if(stu[i].score<stu[i+1].score)
{
temp=stu[i];stu[i]=stu[i+1];stu[i+1]=temp;
}
printf("The order is:\n");
for(i=0;i<3;i++)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
printf("% d,% g\n",stu[i].num,stu[i].score);
printf("\n");
return 0;
}
///改以上三个地方吧,一共是三个人。