帮忙VB试题我怎么想都算不对Private Sub Command1_Click()Dim a As Integer,b As Integer,c As Integera = 5b = 3c = 4Print SecProc(a ,b ,c)End SubFunction FirProc(x As Integer,Y As Integer,z As Integer)FirProc = 2 * x + y + 3 * zEnd FunctionFun
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/09 03:36:32
帮忙VB试题我怎么想都算不对Private Sub Command1_Click()Dim a As Integer,b As Integer,c As Integera = 5b = 3c = 4Print SecProc(a ,b ,c)End SubFunction FirProc(x As Integer,Y As Integer,z As Integer)FirProc = 2 * x + y + 3 * zEnd FunctionFun
帮忙VB试题
我怎么想都算不对
Private Sub Command1_Click()
Dim a As Integer,b As Integer,c As Integer
a = 5
b = 3
c = 4
Print SecProc(a ,b ,c)
End Sub
Function FirProc(x As Integer,Y As Integer,z As Integer)
FirProc = 2 * x + y + 3 * z
End Function
Function SecProc(x As integer ,y As integer ,z As Integer)
SecProc= FroProc( z ,x,y)+x
End Function
我自学的怎么样都不对
SecProc= FroProc( z ,x,y)+x" 应该是
SecProc = FirProc(z,x,y) + x
这个是写错了 呵呵
帮忙VB试题我怎么想都算不对Private Sub Command1_Click()Dim a As Integer,b As Integer,c As Integera = 5b = 3c = 4Print SecProc(a ,b ,c)End SubFunction FirProc(x As Integer,Y As Integer,z As Integer)FirProc = 2 * x + y + 3 * zEnd FunctionFun
我猜你是写错了
"SecProc= FroProc( z ,x,y)+x" 应该是
SecProc = FirProc(z,x,y) + x
你是不明白这个语句的含义吗?
这里直接说一下这个小程序吧.
首先点击按钮将触发Command的Click事件(即Command1_Click).
事件中先定义了a,b,c三个变量为整数类型,并将三个变量赋值.之后调用SecProc函数,并将传回的结果输出到屏幕上.
根据SecProc的函数定义,计算机将按地址传入给函数SecProc的三个参数x,y,z对应传递给FirProc的y,z,x参数.
由于FirProc是一个Function,因此可以传回数值,这个数值被赋值语句("=")传给SecProc.
由于SecProc也是一个Function,因此同理将FirProc的结果传回给Print,作为Print的参数.
随后Print语句将结果输出.
事件结束.