RosettaCodeData/Task/Periodic-table/Craft-Basic/periodic-table.basic

53 lines
568 B
Plaintext

dim a[1, 2, 5, 13, 57, 72, 89, 104]
dim b[-1, 15, 25, 35, 72, 21, 58, 7]
title "Periodic Table Search"
resize 0, 0, 220, 140
center
formid 1
formtext "Search"
buttonform 55, 40, 100, 20
formid 2
formtext ""
staticform 1, 1, 220, 20
do
if forms = 1 then
gosub searchtable
endif
button k, 27
wait
loop k <> 1
end
sub searchtable
input "Atomic number", e
let i = 8
do
let i = i - 1
loop a[i] > e
let m = e + b[i]
let r = int(m / 18) + 1
let c = int(m % 18) + 1
formid 2
formtext "Period: ", r, comma, " Group: ", c
updateform
return