运行,在Text1Box 中输入数组中的数,提示出错,说else 没有if
请高手帮忙改错Option Explicit
Private Sub Command1_Click()
Dim score As Integer
Dim mid As Integer
Dim l As Integer
Dim h As Integer
Dim a() As Integer
a() = Array("45,46,51,58,64,68,77,85,89,98")
l = LBound(a)
h = UBound(a)
score = Text1.Text
Do While l < h
mid = (l + h) / 2
If a(mid) <= score Then mid = l
Else: If a(mid) > score Then mid = h
End If
Loop
Text2.Text = mid
Debug.Print mid
End Sub
请高手帮忙改错Option Explicit
Private Sub Command1_Click()
Dim score As Integer
Dim mid As Integer
Dim l As Integer
Dim h As Integer
Dim a() As Integer
a() = Array("45,46,51,58,64,68,77,85,89,98")
l = LBound(a)
h = UBound(a)
score = Text1.Text
Do While l < h
mid = (l + h) / 2
If a(mid) <= score Then mid = l
Else: If a(mid) > score Then mid = h
End If
Loop
Text2.Text = mid
Debug.Print mid
End Sub
Else: If a(mid) > score Then mid = h
End If If a(mid) <= score Then mid = l
else mid=h
end if
mid = l
Else
If a(mid) > score Then mid = h
End If
mid = l
Else
mid = h
End If ......就这么点东西
a = Array(45,46,51,58,64,68,77,85,89,98)你还是先找本书看看吧