needing help

can anyone recommend a good sorting application - I am trying to design a program for my football league and require a high scores league table

Comments

  • : can anyone recommend a good sorting application - I am trying to design a program for my football league and require a high scores league table
    :


  • : : can anyone recommend a good sorting application - I am trying to design a program for my football league and require a high scores league table
    : :
    :
    :

    Sorting is a BASIC for programming. (No pun intended!)
    There are several ways to sort. My favorite is an oldie but a goodie. The bubble sort. I hope your professor covers this. Here is an example.

    I'm writing this on the fly, so forgive any errors. If there are errors, debug it yourself.

    DIM scores(1 TO 10) AS INTEGER
    FOR i% = 1 TO 10
    READ scores(i%)
    NEXT i%
    'To buuble sort go through the array 1 less than the total.
    'if the next element in the array is smaller swap 'em.
    FOR i% = 1 TO 9
    FOR j% = 1 TO 9 'My tab button doesn't work!
    j1% = j% + 1
    IF scores(j%) > scores(j1%) THEN
    SWAP scores(j%) , scores(j1%)
    END IF
    NEXT j%
    NEXT i%
    'Now the array should be sorted.
    'If you want to print the results, do it yourself.
    DATA 45,86,10,11,56,83,1,77,83,20

    I hope this helps.
    Look it over good, it's not hard to see how it works.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories