Code: Select all
graphics
SET BUTTONS CUSTOM
option base 1
fill color .2,.2,.2
button 0 title "" at 330,150 size 350,370
DEF F(z,X,y)
if z=1 then f=x+y
if z=2 then f=x-y
if z=3 then f=x*y
if z=4 then f=x/y
END DEF
dim h$(17)
h$(1)=7 ! h$(2)=8 ! h$(3)=9 ! h$(4)="+" ! h$(5)=4 ! h$(6)=5 ! h$(7)=6 ! h$(8)="-" ! h$(9)=1 ! h$(10)=2 ! h$(11)=3 ! h$(12)="*" ! h$(13)="С" ! h$(14)=0 ! h$(15)="." ! h$(16)="/" ! h$(17)="="
dim h(4,4)
h(1,1)=1
for i=1 to 4
for i1=1 to 4
fill color .5,.5,.5
x5=x5+1
if x5=4 or x5=8 or x5=12 or x5=16 then fill color .3,.5,.7
if x5=13 then fill color .9,.1,.1
button x5 title h$(x5) at 300+60*i1,200+60*i size 50,50
next i1
next i
fill color .3,.5,.1
button 17 title h$(17) at 600,260 size 50,230
fill color .9,.9,.9
draw color 0,0,0
s$=""
10 FIELD 1 TEXT 0 at 360,180 size 290,50
goto loop
15 FIELD 1 TEXT s$ at 360,180 size 290,50
loop:
for i=1 to 17
i$=i
if button_pressed (i$) then
if i<4 or (i>4 and i<8) or (i>8 and i<12) or i=15 or i=14 then ! s$=s$&h$(i) ! goto 15 ! endif
if i=13 then ! s$="" ! goto 10 ! endif
if i=4 then ! z=1 ! x=FIELD_TEXT$ ("1") ! s$="" ! goto 15 ! endif
if i=8 then ! z=2 ! x=FIELD_TEXT$ ("1") ! s$="" ! goto 15 ! endif
if i=12 then ! z=3 ! x=FIELD_TEXT$ ("1") ! s$="" ! goto 15 ! endif
if i=16 then ! z=4 ! x=FIELD_TEXT$ ("1") ! s$="" ! goto 15 ! endif
if i=17 then ! y=FIELD_TEXT$ ("1")
if z=4 and y=0 then ! FIELD 1 TEXT "ОШИБКА" at 360,180 size 290,50 ! pause 1 ! s$="" ! goto 10
else
s$=f(z,x,y) ! goto 15
endif
endif
endif
next i
goto loop