Sub SingleSorter( byRef arrArray)
Dim row, j
Dim StartingKeyValue, NewKeyValue, swap_pos
For row = 0 To UBound( arrArray ) - 1
'Take a snapshot of the first element
'in the array because if there is a
'smaller value elsewhere in the array
'we'll need to do a swap.
StartingKeyValue = arrArray ( row )
NewKeyValue = arrArray ( row )
swap_pos = row
For j = row + 1 to UBound( arrArray )
'Start inner loop.
If arrArray ( j ) %26lt; NewKeyValue Then
'This is now the lowest number -
'remember it's position.
swap_pos = j
NewKeyValue = arrArray ( j )
End If
Next
If swap_pos %26lt;%26gt; row Then
'If we get here then we are about to do a swap
'within the array.
arrArray ( swap_pos ) = StartingKeyValue
arrArray ( row ) = NewKeyValue
End If
Next
End Sub
Guys.. can u translate it into C++ code?? please....?
Let me guess, you needed Bubble sort in c++, couldn't figure it out on your own. You googled, but got the code in VB instead. Pathetic.
You would get better help if you wanted to seriously learn the algorithms at hand.
Reply:ya that first guy was right on
this is for asking questions, not getting people just to do work for u
hyacinth
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment