Word Sorter

Date: 198x
Type: Program
Platform(s): TS 2068

Word sorter with bold print.

Appears on

Library tape from the Sinclair Computer Users Society (SINCUS).

Source Code

    5 REM sortword2 with                  boldprint CODE           
   10 LOAD ""CODE : RANDOMIZE USR 57786
   12 CLS : BORDER 6
   15 PRINT "    "; INVERSE 1;" W O R D   S O R T E R "
   20 PRINT 
   25 PRINT "       How many words are"'"       you going to sort? ";
   30 INPUT n: PRINT INVERSE 1;n
   35 DIM a$(n,20)
   40 PRINT 
   45 INPUT "Enter the title of the sort. ";l$
   50 PRINT "  Enter the words to be sorted.": PRINT 
   55 PRINT 
   60 FOR m=1 TO n
   65 INPUT a$(m): PRINT m;".";TAB 4;a$(m)
   70 NEXT m
   75 PRINT 
   80 PRINT "   "; INVERSE 1;"Please wait while I sort."
   83 GO SUB 1500
  125 CLS 
  130 PRINT TAB ((32-LEN l$)/2);l$
  135 PRINT 
  138 GO SUB 2000
  155 PRINT : PRINT FLASH 1;"S O R T  I S   C O M P L E T E D"
  160 PRINT : PRINT "    Do you wish to see the list again? (y/n)"
  165 PRINT : PRINT "    If you wish to print the    list then press 'c'."
  170 IF INKEY$="y" THEN CLS : LET m=1: GO TO 130
  175 IF INKEY$="c" THEN CLS : LET m=1: GO SUB 185
  178 IF INKEY$="n" OR INKEY$="N" THEN CLS : RUN 15
  180 GO TO 170
  185 REM  print routine
  187 LPRINT TAB ((32-LEN l$)/2);l$: LPRINT 
  190 FOR m=1 TO n
  195 LPRINT m;".";TAB 4;a$(m)
  198 LPRINT 
  200 NEXT m
  205 LET m=1: GO TO 135
 1500 REM  Shell-Metzner Sort
 1505 LET A=INT (LN N/LN 2): LET F=2^A-1
 1510 LET F=INT (F/2): IF F=0 THEN RETURN 
 1520 LET D=N-F: LET B=1
 1530 LET A=B
 1535 REM  Change Sign(>) in Line 1540 to Reverse Order
 1540 LET E=A+F: IF A$(A)>A$(E) THEN GO TO 1570
 1550 LET B=B+1: IF B>D THEN GO TO 1510
 1560 GO TO 1530
 1565 REM  Change A$ to A in Line 1570 for Number Sort
 1570 LET T$=A$(A): LET A$(A)=A$(E): LET A$(E)=T$
 1580 LET A=A-F: IF A<1 THEN GO TO 1550
 1590 GO TO 1540
 1595 RETURN 
 2000 REM 
 2010 FOR M=1 TO N
 2020 PRINT M;".";TAB 4;A$(M)
 2030 NEXT M
 2040 RETURN 
 9999 SAVE "sortword2" LINE 1: SAVE "boldprint"CODE 57786,100: BEEP 1,32:

People

No people associated with this content.

Scroll to Top