用vb 2008 编写一个简单加密程序,将输入的一行字符串中的所有字母字符加密(非字母不处理)。
提示1:简单加密的思想,将每个字符加一个序数,例如加序数10,这时”A”->”K”,”a”->”k”…。提示2:Asc函数可以得到字符的Ascii码,Chr函数可以将As...
提示1:简单加密的思想,将每个字符加一个序数,例如加序数10,这时”A”->”K”,”a”->”k”…。提示2:Asc函数可以得到字符的Ascii码,Chr函数可以将Ascii码转化为对应的字符。
展开
1个回答
展开全部
Dim S1 As String
Dim S2 As String
S1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ"
S2 = "abcdefghijklmnopqrstuvwxyzabcdefghij"
Dim LStr As String
LStr = "AXDCF1245CDxhsavs" '保存原来的文本
Dim TStr As String
Dim i As Integer
Dim S As String
TStr = ""
For i = 1 To Len(LStr)
S = Mid(LStr, i, 1)
If InStr(S1, S) <> 0 Then
S = Mid(S1, InStr(S1, S) + 10, 1)
ElseIf InStr(S2, S) <> 0 Then
S = Mid(S2, InStr(S2, S) + 10, 1)
End If
TStr = TStr & S
Next i
Print TStr
Dim S2 As String
S1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ"
S2 = "abcdefghijklmnopqrstuvwxyzabcdefghij"
Dim LStr As String
LStr = "AXDCF1245CDxhsavs" '保存原来的文本
Dim TStr As String
Dim i As Integer
Dim S As String
TStr = ""
For i = 1 To Len(LStr)
S = Mid(LStr, i, 1)
If InStr(S1, S) <> 0 Then
S = Mid(S1, InStr(S1, S) + 10, 1)
ElseIf InStr(S2, S) <> 0 Then
S = Mid(S2, InStr(S2, S) + 10, 1)
End If
TStr = TStr & S
Next i
Print TStr
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询