EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 186

Radio Shack TRS-80 Model 3
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
TRS-SO
MODEL III
Array/MatrixManipulation Subroutines
To
use this subroutine,
your
main program must supply values for
two
variables N 1
(number
of
rows) and N2
(number
of
columns). Within the subroutine, you can
assign values to the elements in the array row
by
row
by
answering the INPUT
statement.
10
FOR
ROW
= 1
TO
N1
20
FOR
COL
= 1
TO
N2
](Zt
pr~
I N'r
II
EN'rER DA'rA
F'(H~
II
~
ROW
~
40
INPUT
A(ROW~COL)
~::leJ
NE:x'r
COl...
6(2'
I\lE:
X"I"
1:~Ol,-J
'"1
t~1
F~
E::
''I''
U
r~
1\1
II
"
II
II
n
'1
COL
..
To
use this subroutine,
your
main
program
must supply values for three variables
Nl
(size
of
dim
#1),
N2 (size
of
dim
#2)
and N3 (size
of
dim
#3).
Within the
subroutine, you
can
assign values to
each
element
of
the array using READ and
DATA stateluents.
You
must supply I xJ x Kelements in the following order: row
by
row for K = 1,
row
by
row
for K =2,
row
by row for K =
3,
and so
on
for each value
ofN3.
400
REM
REQUIRES
DATA
STMTSu
410
FOR
K - 1
TO
N3
420
FOR
I = 1
TO
Nl
430
FOR
J = 1
TO
N2
440
READ
A(I,J,K)
L.~)0
NEXT
I..T,
I,
~"\
'1·60
1:~E:'rURN
Main
program
supplies values for variables
Nl,
N2, N3.
The
subroutineprints the
array.
560
FOR
~"\
_.
1
TO
N3
570
FOR
I
..
-
1
TO
Nl
:)80
FOR
J
-
1
TO
N··
..
·
..::
590
PRINT
A(I"J,I·"\),
600
NEXT
J=
PRINT
610
NEXT
I :
PRINT
620
NEXT
~"\
:
PRINT
630
RE"I"URN
6/4

Related product manuals