EasyManuals Logo

Tandy 1000 Basic Reference Manual

Default Icon
411 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
Page #63 background imageLoading...
Page #63 background image
Chmter
61
Arrays
This is a 2-dimensional array. Each element is referred
to
by 2
subscripts:
A(row,column)
For example, A(3,2) points
to
the third week's gas expense.
To
make
a
2-dimensional array from the earlier program, add
the following lines:
25 FOR R
=
1 TO 4:RESTORE
75 NEXT R
105 FOR
R
=
1
TO 4:RESTORE
150 NEXT
R
and change these lines:
20 DIM
A(4,3):
W
=
1
50 PRINT "ENTER THE ";NAMES$;" EXPENSES
IN
DOL-
60 INPUT
A(R,C)
70
NEXT
C:
W
=
W
+
1
100 RESTORE:
W
=
1
130 PR1NT:PRINT NAMES$;" EXPENSE FOR WEEK
140 NEXT
C:W
=
W
+
1
LARS FOR WEEK NO:
"W
NO:
";W;"
=
";ACR,C)
Run this program and see how it works. We simply added an-
other subscript
to
the original array. Now instead of referring
to
an element by a row number only, we refer
to
it by both a row
and column number.
You can add yet another dimension, or subscript, to the array by
adding these lines:
22 FOR P
=
1 TO 2: RESTORE
78
W
=
1:
NEXT P
102 FOR P
=
1 TO 2: RESTORE
160
W
=
1 :NEXT P
and changing these lines:
20
DIM
A<2,4,3):W
=
1:
M
=
1
50 PRINT "ENTER THE ";NAMES$;" EXPENSE IN DOL-
60 INPUT A(P,R,C)
75 NEXT
R:
M
=
M
+
1
100 RESTORE:
W
=
1:
M
=
1
130 PR1NT:PRINT NAMES$;" EXPENSE FOR WEEK
150 NEXT
R:
M
=
M
+
1
LARS FOR WEEK NO:
";W;"
OF MONTH NO:
";M
NO:
";W;"
OF
MONTH
NO:
";M;"
=
";ACP,R,C)
Run the program
to
see how
it
works.
61

Table of Contents

Other manuals for Tandy 1000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Tandy 1000 and is the answer not in the manual?

Tandy 1000 Specifications

General IconGeneral
ProcessorIntel 8088
Processor Speed4.77 MHz
RAM128 KB (expandable to 640 KB)
Operating SystemMS-DOS 2.11
ManufacturerTandy Corporation
Release Year1984
StorageSingle or double 5.25" floppy disk drive (360 KB), optional hard drive
SoundTandy 3-voice sound
PortsParallel, Serial
GraphicsCGA (Color Graphics Adapter)
Graphics Modes320x200, 640x200

Related product manuals