EasyManua.ls Logo

Radio Shack TRS-80 Model III - Page 184

Radio Shack TRS-80 Model III
274 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 store the
data with
alpha-numeric
characters
such
as dashes.
Suppose
we assign
the appropriate values
to the
array elements.
Unless we
have
used a
DIM statement,
the Computer
will assume
that our
array requires
a depth
of
10 for each dimension.
That is.
the
Computer
will
set
aside memory
locations
to
holdCK(7,l).CK(7,2)
CK( 10.1
).CK(
10.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
our program:
40 DIM
CK<6,3>
Now
let's add
program steps
to read the values
into
the array CK:
50 FOR
ROW
=
1
TO 6
60 FOR COL.
=
1 TO
3
70
READ CK(ROW»COL)
80 NEXT COL, ROW
90 DATA
25 ,
1.0178*
10.00
100 DATA 26.
1.0578?
39.95
110 DATA 27,
1.0778i
23.50
120 DATA 28,
1.0778,
149.50
130 DATA
029,
1.1078,
4.90
140 DATA
030,
1.1578,
12.49
Now that
our array is
set
up
,
we can
begin taking
advantage
of its built-in
structure
.
For example,
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(R0W,3)
170
NEXT
180 PRINT
"TOTAL. OF
CHECKS
WRITTEN";
190 PRINT
USING
"$$###.##";
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
#"
, "AMOUNT":
PRINT
240 FOR ROW
=
1 TO
6
250 IF CK(R0W,2)
=
DT THEN
PRINT
CK(ROW,l),
CK(R0W,3)
260 NEXT
It's
easy to generalize
our program
to handle
checkbook information
for all 12
months
and for
years other
than 1
978
.
174

Other manuals for Radio Shack TRS-80 Model III

Related product manuals