Sharp MZ-700 Series Owner's Manual page 72

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

The following program records student grades in English, French, science, and mathemetics to a
sequential data cassette file.
1 0
I N P U T " E N T E R
N O .
O F
S T U D E N T S " ; N
D I M
N $ CN) , K CN) , E CN)
D I M
R CN) , S CN)
A S = " G R A D E
I S "
F O R
X = 1
T O
N
P R I N T : P R I N T
" S T U D E N T
N O .
" ; X
I N P U T " E N T E R
S T U D E N T
N A M E :
20
3 0
4 0
5 0
6 0
7 0
80
9 0
1 00
1 1 0
1 2 0
1 3 0
1 4 0
1 5 0
1 6 0
1 7 0
1 80
1 9 0
N S CX)
P R I N T
P R I N T
P R I N T
P R I N T
E N G
"
F R E N "
" S O I
" M A T H
; A S ;
; A S ;
" ; A S
" ; A S
I N P U T
K CX)
I N P U T
E CX)
: I N P U T
R CX)
: I N P U T
S CX)
N E X T
X
W O P E N " G R A D E S '
P R I N T 0 T
N
F O R
X = 1
T O
N
P R I N T / T
N S CX)
N E X T
X
C L O S E
•C;Closes the cassette ffleT)
E N D
<C=(Opens data file " G R A D E S " for output on cassette tape.)
<C=( Writes the number of students in the class to the file. ]
K CX) , E CX) , R CX) , S CX)
<
Writes grades
to the file.
1 0
20
3 0
4 0
5 0
60
7 0
80
9 0
1 00
1 1 0
1
20
1 3 0
1 4 0
1 5 0
1
6 0
1 7 0
1 8 0
1 9 0
200
2 1
0
Opens cassette file " G R A D E S " for input.]
The following program reads the grade data written to the cassette file by the program shown above,
then calculates displays the grade average for each student and class averages for each of the various
subjects.
R O P E N " G R A D E S "
I N P U T / T
N
Reads the number of people in the class.)
D I M
N S CN) , K CN) , E CN)
D I M
R CN) , S CN)
T O
N
N S CX) , K CX)
E CX) , R CX) , S CX)
F O R
X = 1
I N P U T 0 T
I N P U T / T
N E X T
X
C L O S E
P R I N T
P R I N T
P R I N T
P R I N T
F O R
X =
P R I N T
P R I N T
P R I N T
P R I N T
P R I N T
Reads student names and the grades for
English.
/ i J Reads the grades for French, science
^ , a n d mathematics.
Closes the file.)
T A B C1 0 )
; " E N G
l!
T A B C1 5 )
; " F R E N '
T A B C 2 0 )
; " S C I
"
T A B C 2 5 )
;
1 1
M A T H "
-•1
T O
N
N S CX) ; T A B ( 1 0 )
; K ( X )
2 3 0
2 4 0 .
2 5 0
T A B ( 1 5 )
T A B
( 2 0 )
T A B
( 2 5 )
T A B
( 3 0 )
K ( 0 ) = K ( 0 ) + K ( X )
R ( 0 ) = R ( 0 ) + R
( X )
N E X T
X
P R I N T
T A B ( 1 0 )
;
P R I N T
T A B ( 2 0 )
;
E N D
E ( X )
R ( X )
S ( X )
( K ( X ) + E ( X ) + R ( X ) + S ( X ) )
0 4
: E ( 0 ) = E ( 0 ) + E
( X )
: S ( 0 ) = S ( 0 ) + S
( X )
K ( 0 )
0 N
R ( 0 )
0 N
T A B ( 1 5 )
T A B
( 2 5 )
E ( 0 )
0 N
S ( 0 )
0 N
70-

Advertisement

Table of Contents
loading

Table of Contents