시저 암호를 에뮬레이트하려고합니다. 문제는 "wxyz"를 입력 할 때마다
(시프트 3
) 출력이 "z {|}"입니다. 그러나 예상되는 출력은 "zabc"여야합니다.VB - Caesar Cipher 에뮬레이션
누구에게 추가 할 항목이 있습니까?
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim plaintext As String = TextBox1.Text
Dim charArray() As Char = plaintext.ToCharArray
Dim shift = TextBox2.Text
Dim character As String
Dim temp As String
TextBox3.Text = ""
If shift <> "" And IsNumeric(shift) Then
If plaintext = "" Then
MsgBox("Please input some plain text")
Exit Sub
End If
If shift > 26 Then
MsgBox("Maximum shifts reached. Limit is 26!!")
Exit Sub
End If
For loope = 0 To charArray.Length - 1 Step +1
temp = charArray(loope)
character = Chr(Asc(temp) + shift)
TextBox3.Text += character
Next
Exit Sub
Else
MsgBox("Input numbers only!!")
End If
End Sub
정말 좋은 숙제 :-) – muffi
실제로 중간 프로젝트입니다 :-) –