Radio Shack TRS-80 Model 100 Basic Manual page 138

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

Line 29 The daily sales are read from the RAM file SALEDA.DO and stored in the
array S. The array S, which will contain the sales values, is a two dimensional array
and can be thought of as a table rather than a list. This array will have six rows and
five columns. The rows correspond to the weeks and the columns the days. This may
be illustrated as follows
day
week
1
2
3
4
5
6
MON
S(1,1)
S(2,1)
5(3,1)
5(4,1)
5(5,1)
5(6,1)
TUE
SO ,2)
S(2,2)
5(3,2)
S(4,2)
5(5,2)
5(6,2)
WED
SO ,3)
S(2,3)
5(3,3)
5(4,3)
S(5,3)
S(6,3)
THU
S(1,4)
S(2,4)
5(3,4)
S(4,4)
S(5,4)
S(6,4)
FRI
S( 1,5)
S(2,5)
5(3,5)
S(4,5)
S(5,5)
S(6,5)
The· sales data will be read into the array S so that the first row will contain the five
sales values for the first week, the second row the sales values for the second week,
etc.
Line 39 The first NEXT statement defines the end of the inner loop and the second
NEXT statement defines the end of the outer loop.
Line
49
This line prints the "heading" for the output.
Line 59 The first statement in the line begins another FOR / NEXT loop. This loop
will display the daily sales for each week, starting with week 1, then week 2, etc.,
and ending with week 6. The sales were stored in chronological order, so that the first
five values are the sales for the first week, the next five values are for the second
week, and so on.
The second statement
PRINT Wi
displays the week number. The first time through the loop, a 1 is displayed, the
second time a 2, and the last time a 6 is displayed. Since a semicolon (;) follows the
variable W in the print statement, the carriage return is suppressed.
Line 69 The FOR statement defines an inner loop which increments through all five
days for each week. This loop will display the five daily sales for each week.
Line 79 The daily sales for each week are displayed on one line. The TAB statement
is used to neatly space the sales values along the line. The general form of the TAB
statement is
TAB(x)
and specifies that printing is to begin in column x
+
I.
x
may be a numeric constant,
variable or expression. The values of D, the expression
0*5
and the corresponding print positions are given below:
132

Advertisement

Table of Contents
loading

Table of Contents