'FOR ANDROID
'BEGINNERS
'-----------------------
'An easy example like
'this cannot be found
'around the internet
'makes people like me
'thinking BASIC is too
'complex.
' I hope people here can
' contribute another 100
' simple 20 lines examples,
' later u can see people
' people around the world
' talking back about
' X11-BASIC.
' Playing with ...
' DATA-READ-RESTORE
' What's wrong in my code,
' Lets copy/paste on ur phone
'
CLS
DIM m(10)
RESTORE info
FOR i=0 TO 9
READ t
m(i)=t
n=t(1,1)+t(2,1)+t(3,1)
PRINT m(i);"=";n;" ";
NEXT i
info:
DATA 111,222,333,444
DATA 555,666,777
DATA 888,999
DATA "***"
'
' its cannot display like this
' 111=3 222=6 333=9
' 444=12 555=15 ..
' please help me, tqvm.
' rahimmbigbana@MY
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
'Few days later i found this way
'it works 100% so simple
'
'if u comment off #1 statement
'its will store the output file in
'/storage/emulated/0 of /sdcard0
'
CLS
' OPEN "O",#1,"testing.txt"
start:
READ a,b,c
m=a+b+c
if m=0 then
goto exit
endif
' PRINT #1,a;b;c;" is ";a+b+c
goto start
DATA 1,1,1
DATA 2,2,2
DATA 3,3,3
DATA 4,4,4
DATA 5,5,5
DATA 6,6,6
DATA 7,7,7
DATA 8,8,8
DATA 9,9,9
DATA 0,0,0
exit:
' CLOSE #1
END
'my reference
' A Manual For Basic
' Dartmouth College 1-October-1964
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2019-05-26
I ended up using a string tag for the first column:
Program MusicOfTheHyperspheres
Read Status$
If Status$ <> "EOF" Then
T$ = Status$
Read Tr, Tw, Tx, Ty, Tz
Print T$, Tr, Tw, Tx, Ty, Tz
EndIf
While Status$ <> "EOF"
Read Status$
If Status$ <> "EOF" Then
Sn$ = Status$
Read Snr, Snw, Snx, Sny, Snz
Print Sn$, Snr, Snw, Snx, Sny, Snz,
If Not ((0 <= Snr) And (0 <= Tr)) Then ! Ideally enforced by db
Print "Radius error"
Else If Not ((Tw - Tr <= Snw + Snr) AND (Snw - Snr <= Tw + Tr)) Then
Print "Fail w"
Else If Not ((Tx - Tr <= Snx + Snr) AND (Snx - Snr <= Tx + Tr)) Then
Print "Fail x"
Else If Not ((Ty - Tr <= Sny + Snr) AND (Sny - Snr <= Ty + Tr)) Then
Print "Fail y"
Else If Not ((Tz - Tr <= Snz + Snr) AND (Snz - Snr <= Tz + Tr)) Then
Print "Fail z"
Else If Not (@S(Tw - Snw) + @S(Tx - Snx) + @S(Ty - Sny) + @S(Tz - Snz) \
<= @S(Tr + Snr)) Then
Print "Fail radius",
Print Sqrt(@S(Tw - Snw) + @S(Tx - Snx) + @S(Ty - Sny) + @S(Tz - Snz)),
Print Sqrt(@S(Tr + Snr))
Else
Print "Overlaps "; T$
EndIf
EndIf
Wend
Print "OK"
End
DefFn S(x) = ((x)*(x))
Data Target, 666, 4, 3, 2, -1
Data Enclo1, 220, 1, 1, 1, 1
Data Outsi1, 999, 0, 0, 0, 0
Data Corner, 660, 666, 666, 666, 666
Data ToTheZ, 20, 100, 200, 300, -690
Data EOF
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "Open Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
'FOR ANDROID
'BEGINNERS
'-----------------------
'An easy example like
'this cannot be found
'around the internet
'makes people like me
'thinking BASIC is too
'complex.
' I hope people here can
' contribute another 100
' simple 20 lines examples,
' later u can see people
' people around the world
' talking back about
' X11-BASIC.
' Playing with ...
' DATA-READ-RESTORE
' What's wrong in my code,
' Lets copy/paste on ur phone
'
CLS
DIM m(10)
RESTORE info
FOR i=0 TO 9
READ t
m(i)=t
n=t(1,1)+t(2,1)+t(3,1)
PRINT m(i);"=";n;" ";
NEXT i
info:
DATA 111,222,333,444
DATA 555,666,777
DATA 888,999
DATA "***"
'
' its cannot display like this
' 111=3 222=6 333=9
' 444=12 555=15 ..
' please help me, tqvm.
' rahimmbigbana@MY
View and moderate all "Open Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
'Few days later i found this way
'it works 100% so simple
'
'if u comment off #1 statement
'its will store the output file in
'/storage/emulated/0 of /sdcard0
'
CLS
' OPEN "O",#1,"testing.txt"
start:
READ a,b,c
m=a+b+c
if m=0 then
goto exit
endif
' PRINT #1,a;b;c;" is ";a+b+c
goto start
DATA 1,1,1
DATA 2,2,2
DATA 3,3,3
DATA 4,4,4
DATA 5,5,5
DATA 6,6,6
DATA 7,7,7
DATA 8,8,8
DATA 9,9,9
DATA 0,0,0
exit:
' CLOSE #1
END
'my reference
' A Manual For Basic
' Dartmouth College 1-October-1964
I ended up using a string tag for the first column:
Program MusicOfTheHyperspheres
Read Status$
If Status$ <> "EOF" Then
T$ = Status$
Read Tr, Tw, Tx, Ty, Tz
Print T$, Tr, Tw, Tx, Ty, Tz
EndIf
While Status$ <> "EOF"
Read Status$
If Status$ <> "EOF" Then
Sn$ = Status$
Read Snr, Snw, Snx, Sny, Snz
Print Sn$, Snr, Snw, Snx, Sny, Snz,
If Not ((0 <= Snr) And (0 <= Tr)) Then ! Ideally enforced by db
Print "Radius error"
Else If Not ((Tw - Tr <= Snw + Snr) AND (Snw - Snr <= Tw + Tr)) Then
Print "Fail w"
Else If Not ((Tx - Tr <= Snx + Snr) AND (Snx - Snr <= Tx + Tr)) Then
Print "Fail x"
Else If Not ((Ty - Tr <= Sny + Snr) AND (Sny - Snr <= Ty + Tr)) Then
Print "Fail y"
Else If Not ((Tz - Tr <= Snz + Snr) AND (Snz - Snr <= Tz + Tr)) Then
Print "Fail z"
Else If Not (@S(Tw - Snw) + @S(Tx - Snx) + @S(Ty - Sny) + @S(Tz - Snz) \ <= @S(Tr + Snr)) Then
Print "Fail radius",
Print Sqrt(@S(Tw - Snw) + @S(Tx - Snx) + @S(Ty - Sny) + @S(Tz - Snz)),
Print Sqrt(@S(Tr + Snr))
Else
Print "Overlaps "; T$
EndIf
EndIf
Wend
Print "OK"
End
DefFn S(x) = ((x)*(x))
Data Target, 666, 4, 3, 2, -1
Data Enclo1, 220, 1, 1, 1, 1
Data Outsi1, 999, 0, 0, 0, 0
Data Corner, 660, 666, 666, 666, 666
Data ToTheZ, 20, 100, 200, 300, -690
Data EOF