我试图让这个 Visual Basic 程序将值存储在多维数组中。由于索引超出数组范围,我看到的所有其他错误都是由于数组是在变量之前声明的,但我很确定我在正确的位置声明了我的。任何人都可以看到有什么问题吗?
Randomize()
Dim roll As Integer = 0
Dim player As Integer
Dim index As Integer
Console.Writeline("Enter the number of players: ")
index = Convert.ToInt32(Console.Readline)
player = index - 1
Dim players(player,roll) As Integer
Do Until index = 0
Do Until roll = 5
players(player,roll) = CInt(Int((6 * Rnd()) + 1))
roll +=1
Loop
player -=1
Loop