《VB程序设计》实验报告—过程与函数,求高手出手,急用的,我要程序设计界面,程序代码,运行结果。

2024-12-02 12:34:03
推荐回答(1个)
回答1:

Private Function ADD(ByRef x As Integer, ByRef y As Integer) As Integer
ADD = x + y
End Function

Private Function Multi(x As Integer, y As Integer) As Integer
Multi = x * y
End Function

Private Sub Command1_Click()
x = CInt(InputBox("请输入x的值:", "赋值"))
y = CInt(InputBox("请输入y的值:", "赋值"))
Sum = ADD(Int(x), Int(y))
Text1.Text = CStr(x) + "+" + CStr(y) + "=" + CStr(Sum)
End Sub

Private Sub Command2_Click()
x = CInt(InputBox("请输入x的值:", "赋值"))
y = CInt(InputBox("请输入y的值:", "赋值"))
cheng = Multi(Int(x), Int(y))
Text1.Text = CStr(x) + "*" + CStr(y) + "=" + CStr(cheng)
End Sub