【发布时间】:2013-12-17 13:45:06
【问题描述】:
struct Player
{
public string Name;
public int X;
public int Y;
}
static Player[] players = new Player[amountofPlayers];
for (int i = 1; i < amountofPlayers; i = i + 1)
{
int displayNumber = i + 1;
Console.Write("Please enter the name of player " + displayNumber + ": ");
Player[i].Name = Console.ReadLine(); // The error is here
}
谁能帮我解决这个问题,因为我看不出哪里出错了...
【问题讨论】:
-
这是拼写错误,使用
players[i]而不是Player[i].. 最好使用foreach