Technique To Memorize A Music History - Sharp MZ-80A Owner's Manual

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

87
Technique
to
Memorize a Music History
Statements
for data storage and readouts
can
also be used for
strings.
The five composer's names are written on the cassette
tape
and read out of it.
10 DIM
NS (5)
20
NS
(
1)
=
"BACH"
30
NS
(2)
=
"MOZART"
40
NS
(3)
=
"BEETHOVEN"
50
NS
(4)
=
"CHOPIN"
60
NS
(5)
=
"BRAHMS"
70
WOPEN/T
"GREAT MUSICIANS"
SO FOR J
=
1 TO 5
90
PRINT/T
NS
(J)
100
NEXT
J
110
CLOSE/T
120 END
This
is identical to numeric
data
writing.
Then, readouts
are done as follows:
200 DIM
MS
(5)
210
ROPEN/T
"GREAT MUSICIANS"
220 FOR K
=
1 TO 5
230
INPUT/T
MS
(K)
240 PRINT
MS
(K)
250 NEXT K
260
CLOSE/T
With this, writing and readout are completed. As you may have
noticed, the
name of
string
variable
NS
used for
writing is
different from that of
string variable
MS
used for readouts. Since the value itself
is written in the cassette
tape
as
data, it
has
nothing
to
do with the name of the substituted variable. This makes
it
possible
to change the
variable name
in
the
program as
long as the string data
is. read
by the string variable and the numeral data by the
numeral variable.
Now,
from what you
have learnt
so
far, let's
generate
a data file with mixed
numeric
and
string
data. To also
write
the years when the
previous
composers died, for example, the following statements should be modified from the
previous program.
15 DIM D
(5)
65 D (1)
=
1750 : D (2)
=
1791 : D(3)= 1827
67
D(4)=
1849 : D(5)= 1897
90
PRINT/T
NS
(J),
D (J)
It
is clear
from the above
that the generated file stores string and numeric data in alternate
sequence.
Accordingly,
the readouts
of the
file must match the alternate
sequence, for
which line numbers 200, 230 and 240 should be modi¬
fied as follows:
200 DIM
MS
(5), T (5)
230
INPUT/T
MS (K), T (K)
240
PRINT MS
(K),
T
(K)
With those statements remaining unmodified, the numeric
data
is
transferred
to
the
string variable
MS
( ), causing
an error
to
occur.

Advertisement

Table of Contents
loading

Table of Contents