Console.Write("请输入班级人数:"); int n = int.Parse(Console.ReadLine()); //创建集合 ArrayList banji = new ArrayList(); for (int i = 0; i < n;i++ ) { Console.Write("请输入"+(i+1)+"姓名:"); banji.Add((string)Console.ReadLine()); Console.Write("请输入" + (i + 1) + "成绩:"); banji.Add(double.Parse(Console.ReadLine())); } //按照表格打印出来 Console.WriteLine("班级成绩表"); for (int k = 0; k < 2*n; k=k+2) { Console.WriteLine(banji[k] + " " + banji[k+1]); } Console.ReadLine();