UFT函数调用-根据两个数进行加法和减法运算

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UFT函数调用-根据两个数进行加法和减法运算相关的知识,希望对你有一定的参考价值。

‘根据两个数进行加法和减法运算
‘1、输入+号,则进行加法运算
‘2、输入-号,则进行减法运算

Dim opera,operb,result,oper
MsgBox "+.加法功能"&vbcrlf&"-.减法功能"
oper=InputBox("请选择功能")
opera=InputBox("输入a数据")
operb=InputBox("输入b数据")
Select Case oper
    Case "+" MsgBox addtest(opera,operb)             
    Case "-"    minus  opera,operb
    Case Else MsgBox "输入错误"
End Select

Function addtest(opera,operb)
    addtest=cint(opera)+cint(operb)
End Function

Sub minus(opera,operb)
result=cint(opera)-cint(operb)
MsgBox result
End sub 

以上是关于UFT函数调用-根据两个数进行加法和减法运算的主要内容,如果未能解决你的问题,请参考以下文章