//输入n个人的分数,放入集合当中 ArrayList list = new ArrayList(); for (int i = 0; i < 5; i++) { string s = Console.ReadLine(); list.Add(s); } list.Sort();//排序 list.Reverse();//翻转集合 foreach (string s in list) { Console.WriteLine(s); } Console.ReadLine();
//输入n个人的分数,放入集合当中 ArrayList list = new ArrayList(); for (int i = 0; i < 5; i++) { string s = Console.ReadLine(); list.Add(s); } list.Sort();//排序 list.Reverse();//翻转集合 foreach (string s in list) { Console.WriteLine(s); } Console.ReadLine();