图a
图b为标准ASCII码表供你参考(其中ASCII为1-32,127的字符为特殊符号,不能用作密码):
图b
实现上述功能的VB程序代码如下,请回答以下问题:
①H2?N64Aj ②[26wv9,Q ③$14G/uv ④zX}rb!T&}d2
Private Sub Command1Click()
Dim t As Integer
Dim a(1 To 4) As Integer
flag = True
n = 0
pwd = ""
Randomize
Do While flag
t = ' 随机生成33-126的ASCII码
pwd = pwd + Chr(t)
s = 0
For i = 1 To 4
s = s + a(i)
Next i
n = n + 1
If n >= 6 And s = 4 Then
Loop
Text1.Text = pwd
End Sub
‘ 获取字符类型:1-小写字母,2-大写字母,3-阿拉伯数字,4-符号
Function check(x As Integer) As Integer
If x >= 97 And x <= 122 Then
check = 1
ElseIf x >= 65 And x <= 90 Then
check = 2
ElseIf x >= 48 And x <= 57 Then
check = 3
Else
check = 4
End If
End Function