BCX Console Demonstration Program S107.bas

 DIM I
 DIM Inner
 DIM Outer
 DIM Number
 DIM A$[101]
 
 PRINT "UnSorted ..."
 PRINT
 
 FOR I = 1 TO 100
   A$[I] = STR$(RND * 100)
   PRINT I, "  ", A$[I]
 NEXT
 
 PRINT
 
 PRINT "Sorting ..."
 
 Number = 100
 
 GOSUB Sort
 
 FOR I = 1 TO 100
   PRINT I, "  ", A$[I]
 NEXT
 
 END
 
 Sort:
 FOR Outer = 1 TO Number - 1
   FOR Inner = Outer + 1 TO Number
     IF A$[Inner] < A$[Outer] THEN SWAP A$[Inner], A$[Outer]
   NEXT
 NEXT
 RETURN