Code: Select all
TEST:
LOCAL array1$(10,5),array2$(10,5),i%,j%
i%=1
array1$(i%)=2 :REM etc.
Code: Select all
TEST:
LOCAL array1$(10,5),array2$(10,5),i%,j%
i%=1
j%=2
array(j%)$(i%)=2 :REM etc.
Code: Select all
TEST:
LOCAL array1$(10,5),array2$(10,5),i%,j%
i%=1
array1$(i%)=2 :REM etc.
Code: Select all
TEST:
LOCAL array1$(10,5),array2$(10,5),i%,j%
i%=1
j%=2
array(j%)$(i%)=2 :REM etc.
Code: Select all
TEST:
LOCAL r%,v%,counter%,varible$(7)
REM CM/XP procedure use XTRAN on LZ
REM create test array
IF EXIST("A:TSTARY")
DELETE "A:TSTARY"
ENDIF
CREATE "A:TSTARY",A,no%,value1$,value2$ :REM could have more value$'s
counter%=1
REM dimension test array file with 'blank' data (9 records)
DO
A.no%=counter%
A.value1$="-" :REM would normally be empty strings ""
A.value2$="-" :REM but here use "-" to display later
APPEND
counter%=counter%+1
UNTIL counter%>9 :REM for his exercise limit no. of records to 9
REM Place values in the test array
WHILE varible$<>"Q"
CLS
REM Endless loop only way out is "Q"
PRINT "String (Q=quit)" :INPUT varible$
IF varible$="Q" : GOTO OUTPUT:: :ENDIF
REM 1234567890123456
PRINT "recrd 1 to 9 "; :INPUT r%
PRINT "value 1 or 2 "; :INPUT v%
FIRST
DO
IF A.no%=r% :REM no assignment will take place if r%>counter% OR v%>2
IF v%=1 :A.value1$=varible$ :ENDIF
IF v%=2 :A.value2$=varible$ :ENDIF
UPDATE : BREAK
ENDIF
NEXT
UNTIL EOF
ENDWH
OUTPUT::
REM Display values
FIRST
DO
CLS
REM 1234567890123456
PRINT "Record No. ";A.no%
PRINT LEFT$(A.value1$,7);CHR$(9);LEFT$(A.value2$,7)
PAUSE -100
KEY
NEXT
UNTIL EOF
PRINT "all done.."
GET
Code: Select all
array2d:
local x%,y%,yy%,array$(10,2)
global xx%
xx%=5 :yy%=2
x%=3 :y%=2
array$(i:(x%,y%))="HI"
x%=1 :y%=1
do
do
if array$(i:(x%,y%))=""
array$(i:(x%,y%))="LO"
endif
print array$(i:(x%,y%)),
x%=x%+1
until x%=xx%+1
print
x%=1
y%=y%+1
until y%=yy%+1
get
Code: Select all
i:(x%,y%)
RETURN x%+(y%-1)*xx%