VB编程代码解释,非常感谢

来源:百度知道 编辑:UC知道 时间:2024/05/24 12:28:43
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = 3: b = 4: c = 5
Print secproc(c, b, a)
End Sub
Function secproc(x As Integer, y As Integer, z As Integer)
secproc = firproc(z, x, y) + x + 7

End Function
Function firproc(x As Integer, y As Integer, z As Integer)
firproc = 2 * x + y + 3

End Function

请说明输出结果,并解释一下怎么得到这个结果的,非常感谢。

在Print secproc(c,b,a)里,先调用了firproc(a,c,b)
即fireproc(3,5,4),即2*3+5+3,返回的是14,
然后运算15+c+7,c是5,secproc返回26

即,最后输出26

不过,firproc里虽然有参数z,但却没有用到z,不知道2*x+y+3是不是楼主z*x+y+3的误录。如果是这种误录的话,结果就是32了

Option Base 1
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = 3: b = 4: c = 5
Print secproc(c, b, a) '调用自定义函数过程secproc 其中c,b,a 作为参数对应x ,y ,z
End Sub
Function secproc(x As Integer, y As Integer, z As Integer)
secproc = firproc(z, x, y) + x + 7 'firproc(3,5,4)+5+7 调用完firproc结果为14 14+5+7=26
End Function
Function firproc(x As Integer, y As Integer, z As Integer)
firproc = 2 * x + y + 3 'firproc=2*3+5+3=14
End Function

Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer '定义a,b,c是整形
a = 3: b = 4: c = 5 'A=3 b=4 c=5
Print secproc(c, b, a) '调用secproc函数(下面有的等下说明)
End Sub
Function secproc(x As Integer, y A