小编Jac*_*ack的帖子

使用多个 else if 语句

我试图用 VBScript 制作一个计算器来测试我的技能,但遇到了错误。我的程序使用多个 else if 语句来测试用户输入的内容。

下面是我的代码:

Dim head
Dim msg1, msgErr, msgAns
Dim input1, num1, num2
Dim ans

head = "Calculator"

msg1 = msgBox("Ruan's Vbscript calculator",0,head)
input1 = inputBox("How do you want to calculate? You can type (+ - * /)",head)

num1 = inputBox("Enter your first number",head)
num2 = inputBox("Enter your second number",head)

if (input1 = vbcancel) then
    wscript.quit()
else if (input1 = "+") then
    ans = num1 + num2
else if (input1 = "-") then
    ans = num1 …
Run Code Online (Sandbox Code Playgroud)

vbscript

5
推荐指数
1
解决办法
8055
查看次数

标签 统计

vbscript ×1