通用代码:猜数字
//猜数字import win.ui;
import console;
/*DSG{{*/
var winform = win.form(text="aardio form";right=693;bottom=361)
winform.add(
button={cls="button";text="提交";left=487;top=149;right=592;bottom=196;z=1};
editNumber={cls="edit";left=247;top=149;right=423;bottom=192;edge=1;multiline=1;z=3};
static={cls="static";text="请输入数字";left=53;top=149;right=182;bottom=195;font=LOGFONT(h=-21);transparent=1;z=2};
static2={cls="static";text="猜数字";left=260;top=22;right=411;bottom=79;font=LOGFONT(h=-43);transparent=1;z=4}
)
/*}}*/
//随机数字
randNumber = math.random(1,100)
winform.button.oncommand = function(id,event){
var number = tonumber(winform.editNumber.text):0
if(number==randNumber) {
winform.msgbox("猜中了")
}
elseif(number<randNumber){
winform.msgbox("猜小了")
}
else{
winform.msgbox("猜大了")
}
}
winform.show();
win.loopMessage();
页:
[1]