请在横线处填上合适的代码。
Const MIN_ASC = 65 ′字母“A”的ASCII值
Function X2D(x As String) As String ′字符串小写转成大写
Dim s As String, zf As String, i As Integer
s = “”
For i = 1 To Len(x)
zf = Mid(x, i, 1)
If zf >= “a” And zf <= “z” Then
s = s +
Else
s = s + zf
End If
Next i
X2D = s
End Function
Private Sub Command1_Click()
Dim M As String, K As String, C As String, flag As Boolean
Dim i As Integer, t As Integer, ch As Integer, pos As Integer, j As Integer
M = Text1.Text ′明文
K = Text2.Text ′密钥
t = Len(K)
K = X2D(K) ′将密钥全部转成大写
C = “ ” ′加密后的结果
For i = 1 To Len(M)
ch = Asc(Mid(M, i, 1))
flag = False
If ch >= 97 And ch <= 122 Then ch = ch - 32: flag = True
pos = ′密钥的字符位置值
If pos = 0 Then pos = t
j = Asc(Mid(K, pos, 1)) ′密钥字符的ASCII值
ch = ch - MIN_ASC
j = j - MIN_ASC
ch =
ch = ch + MIN_ASC
If flag Then ch = ch + 32 ′设置字母的大小写形式
C = C & Chr(ch)
Next i
Text3.Text = C
End Sub