Bubble Sorting in VB 6


Private Function ascSort(statement) As String
 Dim a() As String
 Dim temp As String
 Dim num As Integer
 a() = Split(statement, "|")
 num = UBound(a) - LBound(a)
 For i = 0 To num - 1
 For j = i + 1 To num - 1
 If CSng(a(i)) > CSng(a(j)) Then
 temp = a(i)
 a(i) = a(j)
 a(j) = temp
 End If
 Next j
 Next i
End Function

Private Sub Form_Load()
  Dim a,b As String
  a = "5|6|8|9|1"
  b = ascSort(a)
  Print b
End Sub

Mari Berdiskusi Bersama

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s