Array Is The Master Of File Generation - Sharp MZ-80A Owner's Manual

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

Advertisement

58
Array
is the
Master
of File Generation
Some
teachers
say
that testing is all right but putting
test
results
in order is
really hard.
If
so, some
students insist
testing
should be stopped.
A
good method is available for teachers who
are
subject
to
giving
tests
to
students.
The use of
an array
helps them solve the problem! The following shows student identification and marks for
mathematics.
Student No.
20
15
12
40
23
16
31
45
26
1.
Marks
75
51
28
56
100
81
60
43
66
1
48
Generate
a
file program arranged in
the order of
merit.
10 DIM
A
(10), B
(10)
20 FOR
J
=
1 TO 10
30 READ
A (JT), B
(J)
:
NEXT
40 FOR K = 1 TO 9 : M = 0
50 FOR
J = KTO
10
60 IF B (J)
<
= M THEN 80
70 M = B (J) :
L =
J
80 NEXT J
90 B (L) = B (K)
:
B (K)
=
M
100
A 1
=
A
(L) :
A
(L) = A
(K) : A (K)
=
A 1
120 NEXT K
130
PRINT
"S "
140
PRINT
"ORDER OF
MERIT
(MATHEMATICS)"
150 PRINT
160
PRINT "STUDENT
NO."
;
TAB (14)
;
170 PRINT "MARKS"
180 FOR
J = 1 TO 10
190
PRINT
A(J)
;
TAB (14)
;
B (J) . NEXT J
200 END
210 DATA
20, 75,
15,51, 12,28,40,56,23,
100
220 DATA 16,82,31,60,45,43.26,66. 11,48
RUN
ORDER OF MERIT (MATHEMATICS)
STUDENT
No.
MARKS
23
100
16
81
20
75
26
66
31
60
40
56
15
51
11
48
45
43
12
Ready
28

Advertisement

Table of Contents
loading

Table of Contents