2
我正在使用Microsoft Visual Studio 2010和C#。這是一個函數,在我的控制檯程序的其他地方被稱爲窗體,但我似乎無法獲得輸入數組ipoints
。錯誤1無法使用[]將索引應用於'int'類型的表達式
static void GetPoints(int ipoints, string srestaurant)
{
int index = 0;
int iinput;
for (index = 0; index < 5; index++)
{
Console.Write("please enter how many points " + srestaurant[index] + " got : ");
iinput = Convert.ToInt32(Console.ReadLine());
while (iinput < 0 && iinput > 20)
{
Console.Write("please enter how many points " + srestaurant[index] + " got : ");
iinput = Convert.ToInt32(Console.ReadLine());
}
ipoints[index] = iinput;
}
}
感謝幫助了很多,感謝您的快速響應 – blobbymatt