EasyManua.ls Logo

Radio Shack TRS-80 - Page 225

Radio Shack TRS-80
236 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...
One last
word of
advice:
If
you
PRINT
# a list of, say,
10
values
onto tape,
you
should
INPUT # a
list of
10
values also.
If you don't match up
the number
of PRINT
# items
with the number of INPUT
#
items, you'll end up
either losing
data
or going into the
lock-up condition described above.
The
following
program demonstrates how a data file can
be used to create
a
list
of data
items, process and update it.
Study it carefully
and think how similar
programs might
handle inventories, or
any sequential
lists.
1 REM
5 C
=
7 B
=
10 IN .
*AVG
CLS
TEMP AND
HUMIDITY
USING
A
DATA
FILE*
20
30
40
50
53
55
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
2 10
220
230
240
250
"WHAT DAY
OF
'WHAT
WAS THE
THE MONTH
IS IT" ;D
TEMPERATURE
TODAY "
;T
,
"
WHAT WAS THE
D=l
THEN
160
HUMIDITY "
;H
IN
IN
IF
P.
"LOAD
PREVIOUS
TEMPERATURES AND
P. "FIRST REWIND TAPE TO BEGINNING
P,
"THEN
PRESS
RECORDER'S
PLAY
KEY
IN. "PRESS
ENTER WHEN READY" ;A$
FOR X=l TO D-
1
INPUT #
Y.Z
B
=
B+Y
C
=
C+Z
NEXT X
B=( B
+
T )/D
C=CC+H)/D
CLS:P. "THE
AVERAGE
HUMIDITIES
THIS MONTH."
OF
DATA
FILE.
"
TEMPERATURE
IS"
;B
"THE AVERAGE HUMIDITY IS";C
sP.
"NOW THE TRS-80
WILL
WRITE"
"TODAY'S
TEMPERATURE
AND
HUMIDITY"
"ONTO THE
TAPE.
"
"SO
PRESS
RECORD
AND
PLAY KEYS"
"BUT
DO NOT REWIND."
IN. "PRESS ENTER
WHEN READY"
;A$
PRINT
n T;
"
,
"
;H
P.
tP. "NOW
TODAY'S
INFO IS
ADDED TO THE
TAPE
P
.: P. "PLEASE
PRESS STDP KEY
ON THE RECORDER
END
P.
P ,
P.
P,
P.
P,
FILE
ii
Line
70
reads
back
all the
previous days'
numbers,
two at a time.
When all
the information
is
read in, the average
temperature
and
humidity
are
calculated
(using
the current day's
info
as well).
Line
2
1
then writes the
current
day's information
at the end
of
the list.
223

Other manuals for Radio Shack TRS-80

Related product manuals