Для школы
Posted: Fri Apr 24, 2015 6:12 pm
Это программа считает энергию атомов периодической таблицы , и их изотопов . Она мне очень помогла в 9 классе , мой учитель заставил весь класс считать внутреннюю энергию изотопов , на калькуляторе возится с такими числами сложно , поэтому я сделал данную программу как для iPad ,так и для iPhone.
(Скоро сделаю её без участия кнопок -для более быстрой работы)
(Скоро сделаю её без участия кнопок -для более быстрой работы)
Code: Select all
GRAPHICS
IF DEVICE_TYPE$ ()="iPad" THEN
SET ORIENTATION P
i$=0
IF p=2 OR p=4 THEN
IF p=2 THEN
SET ORIENTATION LEFT
END IF
IF p=4 THEN
SET ORIENTATION RIGHT
END IF
ELSE
SET ORIENTATION RIGHT
END IF
END IF
IF DEVICE_TYPE$ ()="iPad" THEN
SET ORIENTATION P
i$=0
IF p=2 OR p=4 THEN
IF p=2 THEN
SET ORIENTATION LEFT
END IF
IF p=4 THEN
SET ORIENTATION RIGHT
END IF
ELSE
SET ORIENTATION RIGHT
END IF
ENDIF
a1=SCREEN_WIDTH() 'ширина экрана
a2=SCREEN_HEIGHT() 'высота экрана
IF a2<a1 THEN
a3=a2
END IF
IF a1<a2 THEN
a3=a1
END IF
OPTION BASE 1
DIM ii$(81)
DATA "H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pb","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Ti","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Rf","Db","Sg","Bh","Hs","Mt"
FOR i=1 TO 81
READ ii$(i)
NEXT i
mp=1.00728
mn=1.00867
me=0.00055
c2=931.5
a4=a1-a3
core=a3/10
cof=core
IF DEVICE_TYPE$ ()="iPad" THEN
corx=a4
END IF
IF DEVICE_TYPE$ ()="iPhone" THEN
corx=0
END IF
cory=0
i=0
FOR k1=1 TO 10
STR+=1
FOR k2=1 TO 10
PAUSE 0.1
i+=1
IF i=81 THEN ! k2=10 ! ENDIF
IF STR=1 THEN
BUTTON i TEXT ii$(i) AT corx+core*6,cory SIZE cof,cof
corx+=core
IF i=2 THEN
k2=10
ENDIF
END IF
IF STR=4 OR STR=6 OR STR=8 OR STR=10 THEN
BUTTON i TEXT ii$(i) AT corx,cory SIZE cof,cof
corx+=core
END IF
IF STR=2 OR STR=3 OR STR=5 OR STR=7 OR STR=9 THEN
BUTTON i TEXT ii$(i) AT corx,cory SIZE cof,cof
corx+=core
IF i=10 OR i=18 OR i=54 OR i=36 OR i=72 THEN
k2=10
END IF
END IF
IF DEVICE_TYPE$ ()="iPad" THEN
BUTTON "star" TEXT "создать" AT 0,0 SIZE 0,cof
END IF
IF DEVICE_TYPE$ ()="iPhone" THEN
BUTTON "star" TEXT "создать" AT 0,a3 SIZE 0,cof
END IF
NEXT k2
IF DEVICE_TYPE$ ()="iPad" THEN
corx=a4
END IF
IF DEVICE_TYPE$ ()="iPhone" THEN
corx=0
END IF
cory+=core
NEXT k1
DRAW COLOR 1,1,1
LOOP:
IF BUTTON_PRESSED ("star")=1 THEN
BUTTON "star" HIDE
FOR i=1 TO 81
i$=i
BUTTON i$ HIDE
NEXT i
FILL COLOR 0,0,0
FILL RECT cof*2,0 TO cof*8, 55
TEXT
INPUT "электроны": elek
INPUT "нуклоны": izot
INPUT "масса": mass
GRAPHICS
IF DEVICE_TYPE$ ()="iPad" THEN
BUTTON "star" SHOW
FOR i=1 TO 81
i$=i
BUTTON i$ SHOW
NEXT i
DRAW TEXT "(" & (elek) & "*" & mp & "+" & (izot-elek) & "*" & mn & "-" & (mass) & ")*" & c2 AT cof*2,0
DRAW TEXT "E= " & (elek*mp+(izot-elek)*mn-(mass) )*c2 AT cof*2,20
DRAW TEXT "Eу= " & ((elek*mp+(izot-elek)*mn-(mass) )*c2)/izot AT cof*2, 40
END IF
IF DEVICE_TYPE$ ()="iPhone" THEN
DRAW TEXT "(" & (elek) & "*" & mp & "+" & (izot-elekb) & "*" & mn AT 0,0
DRAW TEXT "-" & (mass) & ")*" & c2 AT 0,20
DRAW TEXT "E= " & (elek*mp+(izot-elek)*mn-mass)*c2 AT 0,40
DRAW TEXT "Eу= " & ((elek*mp+(izot-elek)*mn-mass)*c2)/izot AT 0, 60
DO
GET TOUCH 0 AS x,y
UNTIL x>3
FILL RECT 0,0 TO a3,a3
BUTTON "star" SHOW
FOR i=1 TO 81
i$=i
BUTTON i$ SHOW
NEXT i
END IF
ENDIF
FOR i=1 TO 81
nomer=i
i$=i
IF BUTTON_PRESSED (i$)=1 THEN
FILL COLOR 0,0,0
FILL RECT 0,0 TO a1,a2
GOSUB tabl
ENDIF
NEXT i
GOTO LOOP
tabl:
FOR i=1 TO 81
i$=i
BUTTON i$ HIDE
NEXT i
BUTTON "star" HIDE
BUTTON "ext" TEXT "назад" AT a1-cof,0 SIZE cof,cof
DO
'r'
''
dat_base
DEF dat_base
mp=1.00728
mn=1.00867
me=0.00055
c2=931.5
RESTORE
DATA 1, 1.00794, 2, 4.002602, 3, 6.941, 4, 9.91216, 5, 10.811,6,12.11,7,14.0067,8,15.9994,9,18.998403,10,20.179,11,22.98977,12,24.30,13,26.98154,14,28.0855,15,30.97376,16,32.066,17,35.453,18,39.948,19,39.0983,20,40.078,21,44.95591,22,47.88,23,50.9415,24,51.9961,25,54.9380,26,55.847,27,58.9332,28,58.69,63,63.546,30,65.39,31,69.723,32,72.59,33,74.9216,34,78.96,35,79.904,36,83.8,37,85.4678,38,87.62,39,88.9059,40,91.224,41,92.9064,42,95.94,43,98,44,101.07,45,102.9055,46,106.42,47,107.8682,48,112.41,49,114.82,50,118.71,51,121.75,52,127.6,53,126.9045,54,131.29,55,132.9054,56,137.33,57,138.9055,72,178.49,73,180.9479,74,183.85,75,186.207,76,190.2,77,192.22,78,195.08,79,196.9665,80,200.59,81,204.383,82,207.2,83,208.9804,84,209,85,210,86,222,87,223,88,226,89,227,104,261,105,262,106,263,107,262,108,265,109,266
FOR nomer=1 TO 162
READ aa1,aa2
IF FRACT (aa2)>.88 THEN
aa3=INTEG (aa2)+1
ELSE
aa3=INTEG (aa2)
END IF
IF nomer=.nomer THEN
IF DEVICE_TYPE$ ()="iPad" THEN
DRAW TEXT "Нуклоны:"&aa3 AT 0,0
DRAW TEXT "Электроны:"&aa1 AT 0,20
DRAW TEXT "масса:"&aa2 AT 0,40
DRAW TEXT "E="&"("&aa1&"*"&mp&"+"&(aa3-aa1)&"*"&mn&"-"&(aa2-aa1*me)&")*"&c2 AT 0,60
DRAW TEXT "E="&(aa1*mp+(aa3-aa1)*mn-(aa2-aa1*me))*c2 AT 0,80
DRAW TEXT "Ey="&((aa1*mp+(aa3-aa1)*mn-(aa2-aa1*me))*c2)/aa3 AT 0,100
ENDIF
IF DEVICE_TYPE$ ()="iPhone" THEN
DRAW TEXT "Нуклоны:"&aa3 AT 0,0
DRAW TEXT "Электроны:"&aa1 AT 0,20
DRAW TEXT "масса:"&aa2 AT 0,40
DRAW TEXT "E="&"("&aa1&"*"&mp&"+"&(aa3-aa1)&"*"&mn AT 0,60
draw text "-"&(aa2-aa1*me)&")*"&c2 at 0,80
DRAW TEXT "E="&(aa1*mp+(aa3-aa1)*mn-(aa2-aa1*me))*c2 AT 0,100
DRAW TEXT "Ey="&((aa1*mp+(aa3-aa1)*mn-(aa2-aa1*me))*c2)/aa3 AT 0,140
END IF
RETURN
ENDIF
NEXT nomer
END DEF
IF BUTTON_PRESSED ("ext")=1 THEN
ex=1
END IF
UNTIL ex=1
FILL COLOR 0,0,0
FILL RECT 0,0 TO a1,a2
BUTTON "ext" DELETE
FOR i=1 TO 81
i$=i
BUTTON "star" SHOW
BUTTON i$ SHOW
NEXT i
ex=0
RETURN