标签:
while (true) { double[,] a = new double[3, 4]; //定义一个三行四列的二位数组 for (int i = 0; i < 3; i++) //循环输出三个人的成绩 { a[i, 0] = i + 1; //显示学号 Console.Write("请输入第"+(i+1)+"个人的语文成绩:"); a[i, 1] = Convert.ToDouble(Console .ReadLine ()); //输入语文成绩 Console.Write("请输入第"+(i+1)+"个人的数学成绩:"); a[i, 2] = Convert.ToDouble(Console .ReadLine ()); //输入数学成绩 a[i, 3] = a[i, 1] + a[i, 2]; //算出总分 } Console.WriteLine("最终结果是:"); Console.WriteLine("学号"+"\t"+"语文"+"\t"+"数学"+"\t"+"总分"); for (int i = 0; i < 3; i++) //输出三行四列 { for (int j = 0; j < 4; j++) { Console.Write(a[i,j]+" "); } Console.ReadLine(); } }
标签:
原文地址:http://www.cnblogs.com/275147378abc/p/4457374.html