I found an 'ideal weight for height' conversion and wrote code for it.
It's in metric, but I wanted imperial also. And not just decimalized.
I knew int/frac had to be used. Never tried more than 1 whole value before.
I did it, but don't ask me to explain it. I just know that it works.
Using L Pad up/down changes the height. Everything else follows it.
Does anyone know imperial? It starts at 175 cm or 5' 9" and inch fraction.
open window 640,512
ycm=175
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")
if and(c,16)>0 ycm=ycm+.01
if and(c,64)>0 ycm=ycm-.01
yin=(ycm/2.54)/12
'ideal height to weight conversion
wkg=(ycm-100)-(.1*(ycm-100))
wst=wkg/6.35
text 120,70,"metric /"
text 220,70,"imperial"
text 10,100,"height"
text 10,180,"weight"
'metric height
text 100,100,str$(ycm)
text 160,100,"cm /"
'imperial height
text 210,100,str$(int(yin))+"'"
text 240,100,str$(int(frac(yin)*12))
text 260,100,str$(int(frac(frac(yin)*12)*8))
text 270,100,"/8"
text 300,100,"in"
'metric weight
text 100,180,str$(wkg)
text 160,180,"kg /"
'imperial weight
text 200,180,str$(int(wst))
text 220,180,"st"
text 250,180,str$(int(frac(wst)*14))
text 270,180,"lb"
text 310,180,str$(int(frac(frac(wst)*14)*16))
text 330,180,"oz"
until (1=0)