home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / compiler / asic / dbgtutor.asi < prev    next >
Text File  |  1994-03-01  |  868b  |  35 lines

  1. dim scores(10)
  2. data 55,33,877,99,44,101,21,88,105,1
  3. rem DBGTUTOR.ASI.  This program is for use with the debugger tutorial.
  4. rem It is a sample bubble sort program containing bugs.
  5.    gosub readscores:
  6.    rem sort the array scores()
  7.    print "Sorting..."
  8.    for i=i to 9
  9.       for j=1 to 9
  10.           j1=j+1
  11.           if scores(j)>scores(j1) then swapentries:
  12. continuesort:
  13.           next j
  14.    next i
  15.    rem now print the results
  16.    print "Here are the sorted scores: "
  17.    for i=1 to 10
  18.       print scores(i);
  19.    next i
  20.    end
  21. swapentries:
  22.    rem this code will swap two entries in the array
  23.    holdentry=scores(j)
  24.    scores(j)=scores(j1)
  25.    scores(j1)=holdentry
  26.    goto continuesort:
  27. readscores:
  28.       print "Orignal Scores:"
  29.       for i=1 to 10
  30.           read scores(i)
  31.           print scores(i);
  32.       next i
  33.       print ""
  34.    return
  35.