主题:新手问个简单编程问题
问题 用 function函数实现两数平均值
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
c = fact(a, b, c)
Print c
End Sub
Private Function fact(x As Integer, y As Integer, z As Integer)
z = (x + y) / 2
这个得出的结果 为什么是0
我知道编的不对 麻烦给个正确的编法 多谢[em2]
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
c = fact(a, b, c)
Print c
End Sub
Private Function fact(x As Integer, y As Integer, z As Integer)
z = (x + y) / 2
这个得出的结果 为什么是0
我知道编的不对 麻烦给个正确的编法 多谢[em2]