berikut design Formnya:
Lalu ketik programnya:
Public Class Gransfeld_Chiper
Private Sub hitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitung.Click
Dim ind As Integer
Dim huruf, kalimat As String
Dim jumlah(25) As Integer
kalimat = (input.Text).ToUpper
For x = 1 To Microsoft.VisualBasic.Len(kalimat)
huruf = kalimat.Substring(x - 1, 1)
If (huruf >= "A") And (huruf <= "Z") Then
ind = Asc(huruf) - 65
jumlah(ind) += 1
End If
Next
hasil.Text = ""
For i As Integer = 0 To 25
huruf = Chr(i + 65)
If jumlah(i) > 0 Then
hasil.Text = hasil.Text & huruf & " = " & jumlah(i) & vbCrLf
End If
Next
End Sub
Private Sub Gransfeld_Chiper_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
input.Text = ""
hasil.Text = ""
End Sub
End Class
Endingnya :
0 komentar:
Posting Komentar