class Program
{
public static void Main()
{
double[,, ] stats = new double[3, 2, 10];
string[] players = new string[3];
int x, y, z;
players[0] = "Tom Brady";
players[1] = "Drew Brees";
players[2] = "Peyton Manning";
for (x = 0; x < 3; ++x)
{
Console.WriteLine("Enter stats for {0}", players[x]);
for (y = 0; y < 2; ++y)
{
Console.WriteLine("Game {0}", y + 1);
stats[x, y, z] = ***inputstats(stats[x, y, z])***;
}
}
}
public static double[] inputstats(double[] methodstats)
{
methodstats = new double[10];
Console.WriteLine("Enter pass attempts: ");
methodstats[0] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter completions: ");
methodstats[1] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter completion percentage: ");
methodstats[2] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter total yards: ");
methodstats[3] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter touchdowns: ");
methodstats[4] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter interceptions: ");
methodstats[5] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter rushing yards: ");
methodstats[6] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter rushing touchdowns: ");
methodstats[7] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter fumbles: ");
methodstats[8] = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Enter QB rating: ");
methodstats[9] = Convert.ToDouble(Console.ReadLine());
return methodstats;
}
}
这是我到目前为止的代码。请记住,我是非常初学者。我正在尝试创建一个控制台,该控制台将在 2 个游戏中要求 3 个不同玩家的用户输入。一旦我得到用户输入的所有数据,我将继续添加提示用户显示游戏 1 statline、游戏 2 statline 或两个游戏平均值的功能。现在我坚持只是得到输入。我收到一个错误,其中粗体和斜体显示最佳重载方法匹配有一些无效参数。我在这里搞砸了什么?我很确定它在 z 中,但我不太确定如何将它输入到 10 个统计数据的数组的第三维中。哈!