public class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入本次比赛的人数");
int count = Convert.ToInt32(Console.ReadLine()); double[][] score = new double[5][];
string[] name = new string[count]; for (int nowcount = 0; nowcount < count; nowcount++)
{
Console.WriteLine("请输入第" + nowcount + "号选手的姓名:");
name[nowcount] = Console.ReadLine();
Console.WriteLine("请输入第" + nowcount + "号选手的各个评委给分:");
score[nowcount] = new double[5];
for (int o = 0; o <= 4; o++)
{
score[nowcount][o] = Convert.ToDouble(Console.ReadLine());
}
} Console.WriteLine("_____________________________________________________________________");
for (int i = 0; i <= count; i++)
{
Console.WriteLine(" " + i + " 号选手: |" + " 最高得分: " + Max(score[i]) + " " + " |最低得分: " + Min(score[i]) + " ");
Console.WriteLine("____________|_________________|________________|________________|");
} Console.ReadLine();
}
static double Max(params double[] array)
{
double max = array[0];
for (int i = 0; i < array.Length; i++)
{
if (max < array[i])
max = array[i];
}
return max;
} static double Min(params double[] array)
{
double min = array[0];
for (int i = 0; i < array.Length; i++)
{
if (min > array[i])
min = array[i];
}
return min;
}
}
运行结果怎么会出现一个空引用?
{
static void Main(string[] args)
{
Console.WriteLine("请输入本次比赛的人数");
int count = Convert.ToInt32(Console.ReadLine()); double[][] score = new double[5][];
string[] name = new string[count]; for (int nowcount = 0; nowcount < count; nowcount++)
{
Console.WriteLine("请输入第" + nowcount + "号选手的姓名:");
name[nowcount] = Console.ReadLine();
Console.WriteLine("请输入第" + nowcount + "号选手的各个评委给分:");
score[nowcount] = new double[5];
for (int o = 0; o <= 4; o++)
{
score[nowcount][o] = Convert.ToDouble(Console.ReadLine());
}
} Console.WriteLine("_____________________________________________________________________");
for (int i = 0; i <= count; i++)
{
Console.WriteLine(" " + i + " 号选手: |" + " 最高得分: " + Max(score[i]) + " " + " |最低得分: " + Min(score[i]) + " ");
Console.WriteLine("____________|_________________|________________|________________|");
} Console.ReadLine();
}
static double Max(params double[] array)
{
double max = array[0];
for (int i = 0; i < array.Length; i++)
{
if (max < array[i])
max = array[i];
}
return max;
} static double Min(params double[] array)
{
double min = array[0];
for (int i = 0; i < array.Length; i++)
{
if (min > array[i])
min = array[i];
}
return min;
}
}
运行结果怎么会出现一个空引用?
解决方案 »
- 这为什么显示不了呢?、、
- direct3D中,使用mesh生成立方体,如何设置透明?
- 请教一个异步通讯的问题。
- winform中,有一个窗体设置f2的topmost为true;请问怎样使messageBox.show探出的对话框在f2窗口的前面
- 有用vista的吗,vista下c#的速度问题解决了吗
- 我下的jmail组件怎么没有pop3呀!谁有?发一个jmail给我
- 我想用C#开发一个与USB接口的摄像头连接并把图像显示出来的程序,不知C#这方面能不能作到?
- 如何通过反射取得类内每个字段的Name属性?
- 怎样在DataGrid格式化显示SQL Server的Numberic字段值?
- 有那么一点点奇怪的问题
- 请求超时问题
- 定时执行代码
数组长度是count,该数据最后一个的索引是 count-1,去掉那个=号就可以了