用vbscript脚本编写猜数字

来源:百度知道 编辑:UC知道 时间:2024/05/14 17:41:04
求用vbscript脚本编写猜数字的代码,要求是猜从1到10之间的随机数字,要求给出猜大猜小的提示!

dim i
do
i=int(1+10*rnd)
u=inputbox("系统已给定一个1~10间的数字,你猜它是多少(输入0,结束程序)","请输入","0")
u=cint(u)
if u=0 then exit do
j=1
do while u<>i
j=j+1
if u>i then
s="你猜的大了"
else
s="你猜的小了"
end if
u=inputbox(s & ",再猜! ","请输入","0")
u=cint(u)
loop
msgbox "你第" & j & "次猜对了,它是" & i
loop