943,843 Members | Top Members by Rank

Ad:
Jul 6th, 2009
0

arranging 5 numbers from lowest to highest PLS HELP

Expand Post »
um ive been asked by my prof to do a program that could possibly arrange 5numbers from lowest to highest..but im kinda new with programing can sumone pls help me THNXX
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stevenaseron is offline Offline
10 posts
since Jul 2009
Jul 6th, 2009
0

Re: arranging 5 numbers from lowest to highest PLS HELP

I which language...?I can pots you one solution in c if you want....
Reputation Points: 18
Solved Threads: 2
Newbie Poster
trshaaa is offline Offline
7 posts
since Apr 2009
Jul 6th, 2009
0

Re: arranging 5 numbers from lowest to highest PLS HELP

jbasic...thnxx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stevenaseron is offline Offline
10 posts
since Jul 2009
Jul 6th, 2009
0

Re: arranging 5 numbers from lowest to highest PLS HELP

There are many sort algorithms in existance. The simplest but slowest is you have all your values in an array and you know the count of the array.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2.  
  3. swap = true
  4. while swap is true
  5. swap = false
  6. for index = 0 to cnt-1 step 1
  7. if ary[index] > ary[index+1] then
  8. tmp = ary[index]
  9. ary[index]=ary[index+1]
  10. ary[index+1] = ary[index]
  11. swap = true
  12. endif
  13. endfor
  14. endwhile

This one is very inefficient but will do the job. In essence the outer loop will loop forever until no swaps occur in the inner loop. This is know as a bubble sort as the numbers bubble along into their correct positions.

I strongly recommend you read up on sorting. Knuth has a great book on the subject containg pseudo code. His books are well worth having a prominent place in your bookcase.


Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. [45][ 3][21][11][2]
  2. 3 45 21 11 2
  3. 3 21 45 11 2
  4. 3 21 11 45 2
  5. 3 21 11 45 2
  6. next outer loop without the little steps
  7. 3 11 21 2 45
  8. 3 11 2 21 45
  9. 3 2 11 21 45
  10. 2 3 11 21 45
Last edited by wildgoose; Jul 6th, 2009 at 11:23 am. Reason: adjustment
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Jul 6th, 2009
0

Re: arranging 5 numbers from lowest to highest PLS HELP

o ok..ow and thnxx alot i really needed these codes
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stevenaseron is offline Offline
10 posts
since Jul 2009
Jul 6th, 2009
0

Re: arranging 5 numbers from lowest to highest PLS HELP

dude can u help me do this in a flowchart ? cuz im told to do it that way PLS HELP ME this really means alot to me THNXX
Last edited by stevenaseron; Jul 6th, 2009 at 11:42 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stevenaseron is offline Offline
10 posts
since Jul 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to control hardware using vb
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Can this vb table structure do like that??





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC