编一加密解密的VB程序,将输入的一串字符进行加密。
1加序数5,这时“A”→“F”,“a”→“f”,“B”→“G”.........“Y”→“D”,“Z”→“E2最好用VB2008版写,谢谢!!!...
1加序数5,这时“A”→“F”,“a”→“f”,“B”→“G”.........“Y”→“D”,“Z”→“E2最好用VB2008版写,谢谢!!!
展开
1个回答
2013-06-28
展开全部
Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = TextBox1.Text
TextBox2.Text = jiam(s) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
s = TextBox2.Text
TextBox3.Text = jiem(s)
End Sub
Private Function jiam(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 85, 97 To 117
s1 = s1 & Chr(a + 5)
Case 86 To 90, 118 To 122
s1 = s1 & Chr(a - 21)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiam = s1
End Function
Private Function jiem(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 69, 97 To 101
s1 = s1 & Chr(a + 21)
Case 70 To 90, 102 To 122
s1 = s1 & Chr(a - 5)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiem = s1
End Function
End Class
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = TextBox1.Text
TextBox2.Text = jiam(s) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim s As String
s = TextBox2.Text
TextBox3.Text = jiem(s)
End Sub
Private Function jiam(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 85, 97 To 117
s1 = s1 & Chr(a + 5)
Case 86 To 90, 118 To 122
s1 = s1 & Chr(a - 21)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiam = s1
End Function
Private Function jiem(ByVal s As String)
Dim s1 As String
s1 = ""
For i = 1 To Len(s)
Dim a As Integer
a = Asc(Mid(s, i, 1))
Select Case a
Case 65 To 69, 97 To 101
s1 = s1 & Chr(a + 21)
Case 70 To 90, 102 To 122
s1 = s1 & Chr(a - 5)
Case Else
s1 = s1 & Chr(a)
End Select
Next
jiem = s1
End Function
End Class
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |