1
喜IM上投入的忽略,將這些代碼有問題有麻煩IGNORECASE
Console.WriteLine("Select a seat that you want to ocupy");
string UserInput = Console.ReadLine();
//replacing array values with X
for (int row = Arr.GetLowerBound(0); row <= Arr.GetUpperBound(0); ++row)
{
for (int column = Arr.GetLowerBound(1); column <= Arr.GetUpperBound(1); ++column)
if (Arr[row, column].Contains(UserInput))
{
Arr[row, column] = " X ";
}
}
我通過UserInput 以「X」代替一個二維數組值這裏是我的陣列
string[,] Arr = new string[,]
{{"A1" , " A2" , " A3" , " A4" , " A5"},
{"B1" , " B2" , " B3" , " B4" , " B5"}};
請解釋一下您放置代碼和什麼異常沒有收到 – Tushar 2014-10-06 04:48:07
我試圖把的忽略這一行,如果(ARR [行,列]。包含(UserInput)) – Josh 2014-10-06 04:51:16
請更新您的錯誤代碼 – Tushar 2014-10-06 04:52:48