|
-
Nov 28th, 2000, 10:33 AM
#1
Thread Starter
Member
Hi, if I have an array of say 50 numbers.
how do I get the Biggest Number, Smallest number and
sort them into assending or desending order
thanks
MICK
-
Nov 28th, 2000, 10:39 AM
#2
Frenzied Member
Go look at this thread.
You should search the forum before asking a question,
just a tip
-
Nov 28th, 2000, 10:42 AM
#3
Addicted Member
-
Nov 28th, 2000, 10:46 AM
#4
_______
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 28th, 2000, 12:21 PM
#5
Fanatic Member
There are a lot of ways to sort an array. The bubble sort is the easiest. It's also the slowest. But if the arrays aren't too big, speed doesn't really matter. To do a bubble sort:
Code:
Dim List(1 To 5) As String 'the array
Dim Swap As String 'temporary
Dim I As Integer 'for loops
Dim J As Integer 'for loops
List(1) = "Hello"
List(2) = "Bye"
List(3) = "Lala"
List(4) = "Blabla"
List(5) = "Kaboom"
'sort them
For I = 1 To UBound(List)
'the bubble sort moves large values to the top
For J = 1 To UBound(List) - 1
'compare them
If List(J) > List(J + 1) Then
'list(x)>list(x+1)
Swap = List(J + 1)
List(J + 1) = List(J)
List(J) = Swap
End If
Next
Next
-
Nov 28th, 2000, 12:44 PM
#6
_______
<?>
Oetje :
Alpha and numeric are different sorts. My post, the one above yours on this thread, demonstates a numeric bubble sort....if interested.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 28th, 2000, 12:48 PM
#7
Fanatic Member
Good code HeSaidJoe, but you should comment it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|