import java.util.Scanner; class Student{ public String Name; public String Sex; public int Age; public int Score; } public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Student[]s=new Student[n]; for (int i = 0; i < s.length; i++) { s[i]=new Student(); s[i].Name=sc.next(); s[i].Sex=sc.next(); s[i].Age=sc.nextInt(); s[i].Score=sc.nextInt(); } for (int i = 0; i < s.length-1; i++) { for (int j = 0; j < s.length-1; j++) { if(s[j].Score>s[j+1].Score){ String temp=s[j].Name; s[j].Name=s[j+1].Name;s[j+1].Name=temp; temp=s[j].Sex; s[j].Sex=s[j+1].Sex;s[j+1].Sex=temp; int temp2=s[j].Age; s[j].Age=s[j+1].Age;s[j+1].Age=temp2; temp2=s[j].Score; s[j].Score=s[j+1].Score;s[j+1].Score=temp2; } } } for (int i = 0; i < s.length; i++) { System.out.println(s[i].Name+" "+s[i].Sex+" "+s[i].Age+" "+s[i].Score); } } }
0.0分
1 人评分
1113题解浏览:787 |
C二级辅导-公约公倍 (C语言代码)浏览:483 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:772 |
字符逆序 (C语言代码)浏览:508 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:528 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:602 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:800 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:545 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:1000 |
1202题解浏览:623 |