VB编程中运行没问题,为什么调试时总出现黄色段?
OptionBase1PrivateFunctionaverage(a()AsInteger)AsSingleDimstartAsInteger,finishAsInte...
Option Base 1
Private Function average(a() As Integer) As Single
Dim start As Integer, finish As Integer
Dim i As Integer
start = LBound(a)
finish = UBound(a)
Sum = 0
For i = start To finish
Sum = Sum + a(i)
Next
average = Sum / finish
End Function
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
aver = average(arr2)
Print "平均值是:"; aver
End Sub
在Private Sub Command1_Click()出现黄色段 展开
Private Function average(a() As Integer) As Single
Dim start As Integer, finish As Integer
Dim i As Integer
start = LBound(a)
finish = UBound(a)
Sum = 0
For i = start To finish
Sum = Sum + a(i)
Next
average = Sum / finish
End Function
Private Sub Command1_Click()
Dim arr1
Dim arr2(4) As Integer
arr1 = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text), Val(Text4.Text))
For i = 1 To 4
arr2(i) = CInt(arr1(i))
Next i
aver = average(arr2)
Print "平均值是:"; aver
End Sub
在Private Sub Command1_Click()出现黄色段 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询