VBS学习笔记:简单程序(2)

该文展示了一系列VBScript的基础用法,包括从用户获取输入(inputbox),进行条件判断(if...then...else),数值计算(乘法、除法、模运算),显示消息(msgbox),以及简单的错误处理。此外,还涉及了字符串操作和循环结构,如密码验证和选择结构(selectcase)。
摘要由CSDN通过智能技术生成
dim s,r
const pi=3.14
r=inputbox("请输入圆的半径")
s=pi*r*r
msgbox s
dim a,b
a=inputbox("请输入一个大于60的数字")
b=inputbox("请输入一个大于100的数字")
a=int(a)
b=int(b)
if a>60 and b>100 then
msgbox "合格"
else
msgbox "不合格"
end if
dim a
a=inputbox("请输入一个大于60的数字")
a=int(a)
if a>60 then
msgbox "合格"
else if a=60 then
msgbox "刚好60"
else
msgbox "不合格"
end if
end if
dim a,b,c,d
a=inputbox("请输入a值")
b=inputbox("请输入b值")
c=inputbox("请输入c值")
d=a*3+b*3
c=int(c)
if c=d then
msgbox "right"
else
msgbox "error"
end if
dim a,b
a=18
b=16
if a>b then
msgbox "a>b"
end if
dim a
a=inputbox("请输入数字")
a=int(a)
select case a
case 1
msgbox "one"
case 2
msgbox "two"
case 3
msgbox "three"
case else
msgbox "error"
end select
dim passwd
const pass="123456"
do 
passwd=inputbox("请输入密码")
if passwd=pass then
msgbox "密码输入成功"
exit do
end if
loop
dim a 
a=21 mod 5
msgbox a

dim b
b=21/5
msgbox b

dim c
c=2^2
msgbox c

dim d,e,f
d="3"
e="4"
f=d+e
msgbox f

dim g
g=3.14
msgbox int(g)
dim a,b,s
a=20
b=10
s=a/b+b
msgbox s
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值