Mengurutkan karakter menggunakan metode bubble short dengan Visual Basic 6.0 [Jadul Edition]

Private Sub tmblurut_Click()
Dim i As Integer
Dim A(20) As Integer
n = Len(Trim(txtasal.Text)) 'menghitung teks
Print n
    For k = 1 To n
        A(k) = Asc(Mid(txtasal.Text, k, 1)) 'mencari kode ASCII
    Next k
For i = 1 To n - 1
    For k = 1 To n - 1
        If A(k) > A(k + 1) Then
        d = A(k)
        A(k) = A(k + 1)
        A(k + 1) = d
        End If
    Next k
Next i
            For i = 1 To n
                    komponen = Chr(A(i)) 'mengembalikan nilai ASCII
                    hasil = hasil + komponen
                    hasilakhir.Caption = hasil 'RESULT
            Next i
End Sub

Leave a Reply

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

%d bloggers like this: