I was trying to rewrite an older program with arrays, in a more modern way, but I got stuck on the way! :-)
To start with basics, lets take a tiny program, that reads 2 numbers (from keyboard), and adds them (and then displaying the result on screen).
Code: Select all
DIM AS UBYTE NR(2), Z, N
FOR N=1 TO 2
INPUT NR(N)
PRINT NR(N)
NEXT
PRINT "----------------"
PRINT NR(1)
PRINT NR(2)
PRINT "----------------"
PRINT "SUM"
Z=NR(1)+NR(2)
PRINT Z
So far, so good!
(At least, I think so)! :-)
The only problem is, that the above program, works with integers.
Lets rewrite it, so it will work with real numbers:
Code: Select all
DIM AS UBYTE N
DIM AS SINGLE NR(2), Z
FOR N=1 TO 2
INPUT NR(N)
PRINT NR(N)
NEXT
PRINT "----------------"
PRINT NR(1)
PRINT NR(2)
PRINT "----------------"
PRINT "SUM"
Z=NR(1)+NR(2)
PRINT Z
Nope! It doesn't adds. Just displaying the 1st number.
Ehm...Am I missing something???
TIA!!! :-)
G.