VBS猜数游戏

时间:2023-03-09 20:39:46
VBS猜数游戏

VBS 猜数游戏

2018-11-09  21:19:11

by xutao

 msgbox "The Swami" ,,"Game"
msgbox "The system will give a integer in the range of 1 to 100 randomly, and you are allowed to guess a integer one time! Less tries, more luck" , ,"Rule"
while = '无限循环 dim tryTime '尝试次数
tryTime = dim n
randomize '初始化随机种子,不然每次都会一样
n = int(rnd*) int input
input = int(inputbox("Guess it")) '注意:while语句的语法是: while condition ... wend (不加then) while n <> input
tryTime = tryTime+
if input>n then
input = int(inputbox("Too big! Try again!"))
else
input = int(inputbox("Too small! Try again!"))
end if
wend if tryTime= then
msgbox "Genius! Buy a lottery ticket quickly!"
elseif tryTime= then
msgbox ""
elseif tryTime= then
msgbox "NB"
elseif tryTime= then
msgbox "Cool!"
elseif tryTime= then
msgbox "Good!"
elseif tryTime= then
msgbox "Not Bad!"
elseif tryTime= then
msgbox "Unfortuntate!"
elseif tryTime= then
msgbox "Idiot!"
else
msgbox "SB!"
end if if msgbox("ReTry?",vbOK)<> then
msgbox "Bye!"
wscript.quit
end if wend