这个程序哪里出问题?求高手解答...
将label4中的字符串2个一组,转换为ascii码,并随机产生一个2位数,ascii是字母,字母按此随机数后移相应位子,如果位移超出最后一个字母,则从第一个字母开始循环...
将label4中的字符串2个一组,转换为ascii码,并随机产生一个2位数,ascii是字母,字母按此随机数后移相应位子,如果位移超出最后一个字母,则从第一个字母开始循环,如果不是字母,则保持原值
Private Sub Command3_Click()
Dim w, d, j As String, p As Integer, l As Long
w = Label4.Caption
n = 1
d = Mid$(w, n, 3)
While n <= Len(w)
n = n + 3
If Val(d) >= 0 And Val(d) <= 255 Then
d = Chr$(Val(d))
If d >= "a" And d <= "z" Then
p = Asc(d) - 97
j = Chr$((p + Int(10 * Rnd + 10)) Mod 26 + 97)
Else
If d >= "A" And d <= "Z" Then
p = Asc(d) - 65
j = Chr$((p + Int(10 * Rnd + 10)) Mod 26 + 65)
Else
j = Asc(d)
If j = 0 Then
j = " "
End If
End If
End If
Else
j = d
End If
l = l + j
d = Mid$(w, n, 3)
Wend
Label6.Caption = l
End Sub 展开
Private Sub Command3_Click()
Dim w, d, j As String, p As Integer, l As Long
w = Label4.Caption
n = 1
d = Mid$(w, n, 3)
While n <= Len(w)
n = n + 3
If Val(d) >= 0 And Val(d) <= 255 Then
d = Chr$(Val(d))
If d >= "a" And d <= "z" Then
p = Asc(d) - 97
j = Chr$((p + Int(10 * Rnd + 10)) Mod 26 + 97)
Else
If d >= "A" And d <= "Z" Then
p = Asc(d) - 65
j = Chr$((p + Int(10 * Rnd + 10)) Mod 26 + 65)
Else
j = Asc(d)
If j = 0 Then
j = " "
End If
End If
End If
Else
j = d
End If
l = l + j
d = Mid$(w, n, 3)
Wend
Label6.Caption = l
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询