热门

最新

红包

立Flag

投票

同城

我的

发布
m0_52178267
m0_52178267
6 年前
truem0_52178267

求解!?
#include<stdio.h>
struct students{
int num;
char name[50];
double score;
};
int main(void)
{
int n,i,j,index,temp;
struct student s[50]
while(scanf("%d",&n)!=EOF){
for(i=0;i<n;i++){
scanf("%d",&s[i].num);
scanf("%s",&s[i].name);
scanf("%d",&s[i].score);
}
for(i=0;i<n-1;i++){
index=i;
for(j=i+1;j<n;j++){
if(s[j].score>s[index].score)
index=j;
temp=s[index];
s[index]=s[i];
s[i]=temp;
}
}
for(i=0;i<n;i++)
printf("%d%s%d\n",s[i].num,s[i].name,s[i].score);
}
return 0;
}

杭州市白杨街道
CSDN App 扫码分享
分享
1
2
打赏
  • 复制链接
  • 举报
下一条:
在?还是都去过节去啦?我又来督促你们学习啦!为了年终奖冲鸭!jshistory-cn 《JavaScript 20 年》中文版。记述了自 1995 年诞生到 2015 年 ES6 规范制定为止,20 年的 JavaScript 语言演化历程。从语言诞生、创立标准、改革失败到继往开来四部分详细的讲述了他的“前世今生”。觉得教科书枯燥无味难以理解的,正好可以看看“由来”,知“古”懂“今”哦!https://hellogithub.com/periodical/volume/54/#jshistory-cn
立即登录