home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nibble Magazine
/
nib19b.dsk
/
MAIN.VERSION.1.bas
< prev
next >
Wrap
BASIC Source File
|
2023-02-26
|
1KB
|
37 lines
10 REM ---MAIN PROGRAM
20 TEXT : HOME : PRINT "** COPYRIGHT 1984 BY MICROSPARC, INC. **": PRINT : DIM D%(100)
30 PRINT "READING DATA.."
40 GOSUB 200: REM GOSUB THE READ ROUTINE
50 PRINT "SORTING DATA.."
60 GOSUB 300: REM GOSUB THE SORT ROUTINE
70 PRINT "PRINTING DATA.."
80 GOSUB 400: REM GOSUB THE OUTPUT ROUTINE
90 PRINT "NO ERRORS. NORMAL TERMINATION."
100 END
200 REM ---READ DATA INTO D%()
210 N = 0: RESTORE
220 READ T
230 IF T <0 THEN RETURN
240 N = N +1
250 D%(N) = T
260 GOTO 220
300 REM ---SORT N ITEMS OF DATA IN D%()
310 IF N <2 THEN RETURN : REM THE LIST IS TOO SMALL TO SORT
320 FOR I = 2 TO N
330 FOR J = 1 TO I
340 IF D%(J) < = D%(I) THEN 360
350 T = D%(I):D%(I) = D%(J):D%(J) = T
360 NEXT J
370 NEXT I
380 RETURN
400 REM ---PRINT OUT DATA IN D%()
410 IF N >0 THEN 430
420 PRINT "NO DATA WAS READ OR SORTED.": RETURN
430 FOR I = 1 TO N
440 PRINT D%(I)
450 NEXT I
460 RETURN
500 REM ---DATA TO SORT
510 DATA 11,2345,45,234,6,68,556,56,75,345
520 DATA 234,233,3978,7768,678,79,6,56,7
530 DATA -1