VBnet 大哥们指点一下
程序代码:
Public Class Form1 Dim b As Integer, c As Integer, j As Integer, i As Integer, a(i) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click b = InputBox("请输入第一个数") c = InputBox("请输入第二个数") TextBox1.Text = Str(b) + "" + Str(c) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click j = 0 For i = 0 To 4 a(i) = Int(Rnd() * 21 + 1) Next If a(i) = b Or a(i) = c Then j = j + 1 End If If j = 2 Then MsgBox("中奖") Else MsgBox("没种") End If End Sub End Class运行后说a(i)=int(rnd()*21+1)这里超出了数组索引,怎么回事 我又应该怎么修改呢