VB数组下标越界
PrivateSubForm_Click()Dima()AsVariantDimtAsIntegera=Array(5,4,9,8,6,1)Fori=0To5Forj=0...
Private Sub Form_Click()
Dim a() As Variant
Dim t As Integer
a = Array(5, 4, 9, 8, 6, 1)
For i = 0 To 5
For j = 0 To 5 - i
If a(i) < a(i + 1) Then
t = a(i)
a(i) = a(i + 1)
a(i + 1) = t
End If
Next j
Next i
Print a(5)
End Sub 展开
Dim a() As Variant
Dim t As Integer
a = Array(5, 4, 9, 8, 6, 1)
For i = 0 To 5
For j = 0 To 5 - i
If a(i) < a(i + 1) Then
t = a(i)
a(i) = a(i + 1)
a(i + 1) = t
End If
Next j
Next i
Print a(5)
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询