'---------------------------------------- ' ALPHA.BAS ' Programmed by QP7 on 2/27/97 ' http://www.pobox.com/~qp7 '---------------------------------------- CLS COLOR 9: PRINT "Alphabetizer" COLOR 14: PRINT "------------" COLOR 9: PRINT "Alphabetizes a text file and outputs to an outfile text file" PRINT COLOR 15: INPUT "Filename to aphabetize: ", filename$ COLOR 15: INPUT "Ouput filename: ", outfile$ OPEN filename$ FOR INPUT AS #1 WHILE NOT EOF(1) LINE INPUT #1, temp$ numlines% = numlines% + 1 WEND DIM strings$(1 TO numlines%) SEEK #1, 1 FOR i% = 1 TO numlines% LINE INPUT #1, strings$(i%) NEXT i% FOR i% = 1 TO numlines% FOR j% = numlines% - 1 TO i% STEP -1 IF strings$(j%) > strings$(j% + 1) THEN SWAP strings$(j%), strings$(j% + 1) END IF NEXT j% NEXT i% CLOSE #1 OPEN outfile$ FOR OUTPUT AS #1 FOR i% = 1 TO numlines% PRINT #1, strings$(i%) NEXT i% CLOSE #1 COLOR 14: PRINT "[ data written to "; outfile$; " ]"