define variable dn as integer label "请输入一个整数".
define variable i as integer label "你一共猜了多少次".
define variable dn_1 as integer.
define variable choose as integer.
define variable str01 as char format "x(20)" label "提示".
define frame b skip(1) with centered three-d side-label.
define frame a with centered.
define frame c with centered no-box.
disp "猜数子小游戏" with frame c.
repeat:
i = 0.
choose = 0.
dn = 0.
update dn with frame b.
dn_1 = dn.
dn = 0 .
display dn with frame b.
repeat:
i = i + 1.
update choose with frame a.
if choose = dn_1 then do:
str01 = "恭喜你答对了".
dn = dn_1.
display dn with frame b.
display str01 i with frame a.
leave .
end.
else if choose > dn_1 then do:
str01 = "太大了".
display str01 with frame a.
end.
else if choose < dn_1 then do:
str01 = "太小了".
display str01 with frame a.
end.
end.
end.