EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 184

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-80 MODEL III
Notice that the date information is recorded in the form
mm
.ddyy. where
mm
=month number,
dd
=day
of
month, and
yy
=last two digits
of
year. Since
CK
is
a numeric
array,
we
can't
storethe datawith alpha-numeric characters
suchas dashes.
Suppose we assign the appropriate values to the array elements. Unless we have
used a
DIM
statement, the Computer will assume that ourarray requires a depth
of
10 for each dimension. That is, the Computer will set aside memory locations to
hold
CK(7,
I),
CK
(7,2),
...
,
CK(lO,
I).
CK(lO,2)
and CK( 10.3). In this case, we
don't
want to set aside this much space, so we use the
DIM
statement at the beginning
of
ourprogram:
Now
let's
add programsteps to read the values intothe array
CK:
50
FOR
ROW
= 1
TO
6
60
FOR
COL
= 1
TO
3
70
READ
CKCROW,COL)
80
NEXT
COL,
ROW
90
DATA
025,
1"0178,
10a00
100
DATA
026,
la0578,
39a95
110
DATA
027,
la0778,
23a50
120
DATA
028,
1.0778,
149.50
130
DATA
029,
la1078,
4a90
140
DATA
030,
1.1578,
12.49
Now that
our
array is set
up,
we canbegin taking advantage
of
its built-in structure.
Forexample, suppose we want to add up all the checks written. Add the following
lines to the program:
150
FOR
ROW
= 1
TO
6
160
SUM
=
SUM
+ CK(ROW,3)
170
NEXT
180
PRINT "TOTAL
OF
CHECKS
WRITTEN";
190
PRINT USING
"$S##la#I";
SUM
Now
let's
add program steps to print out all checks that were written on a given day.
200
PRINT "SEEKING
CHECKS
WRITTEN
ON
WHAT
DATE
(MM.DD
YY)";
210
INPUT
DT
220
PRINT:
PRINT
"ANY
CHECKS
WRITTEN
ARE
LISTED BELOW:"
230
PRINT
"CHECK
I",
"AMOUNT": PRINT
240
FOR
ROW
= 1
TO
6
250
IF
CK(ROW,2) =
DT
THEN
PRINT
CK(ROW,l),
CK(ROW,3)
260
NEXT
It's
easy to generalize ourprogram to handle checkbook informationfor all 12
months and for years otherthan 1978.
6/2

Related product manuals