`include
struct struct_name
{
char name[20];
char num[20]; 
float score;
}student[3];
void sort(struct struct_name *p)
{ struct struct_name temp,*p1; int i, j;
printf("lololololol");
for(i=0;i for(j=0;j if(p->score<(p+1)->score){

temp=*p;
*p=*p1;
*p1=temp;
}
p++;


}

int main()
{
struct_name student [3]={{"Tom","15",97.2},{"Boy","16",98.1},{"Smith","18",99.0}};
sort(student);
int i;
for(i=0;i<3;i++){
printf("姓名:%s\n学号:%s\n成绩:%.1f\n",student[i].name,student[i].num,student[i].score);
}
return 0;
}


  • TIMI    2020-02-14 11:51:10
  • 阅读 1736    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信