VB函数定义问题
本帖最后由 bcrun 于 2013-02-24 10:44:32 编辑
Sub jiec(x As Single)
Dim i As Single
For i = 1 To x
jiec = jiec * i
End Sub
Function he(a() As Single) As Single
For i = a(LBound(a)) To a(UBound(a))
he = he + jiec(a(i))
Next i
Print he
End Function
Private Sub Command1_Click()
Dim a(2) As Single
a(0) = InputBox("输入数据")
a(1) = InputBox("输入数据")
a(2) = InputBox("输入数据")
he a()
End Sub
Function jiec(x As Single) '改这里
Dim i As Single
For i = 1 To x
jiec = jiec * i
End Sub
Function he(a() As Single) As Single
For i = a(LBound(a)) To a(UBound(a))
he = he + jiec(a(i))
Next i
Print he
End Function
Private Sub Command1_Click()
Dim a(2) As Single
a(0) = InputBox("输入数据")
a(1) = InputBox("输入数据")
a(2) = InputBox("输入数据")
he a()
End Sub