home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a079 / 1.img / FPDG.LZH / VOL2NUM0 / MISC / SORT.PRG < prev    next >
Encoding:
Text File  |  1993-02-01  |  534 b   |  23 lines

  1. ****************************************************************
  2. * SORT.PRG - Sorts contents of an array using a bubble sort
  3. ****************************************************************
  4. USE people
  5. COPY TO ARRAY names FIELDS name
  6. length = ALEN(names)
  7. FOR j = 1 TO length
  8.     K = j + 1
  9.     FOR K = j+1 TO length-1
  10.         IF names[K] > names[J]
  11.             temp       = names[J]        && Permute Values
  12.             names[J] = names[K]
  13.             names[K] = temp
  14.         ENDIF
  15.     ENDFOR
  16. ENDFOR
  17. ? "Array is sorted"
  18. FOR j = 1 TO length
  19.     ? names[J]
  20. ENDFOR
  21. RETURN
  22.  
  23.