vb程序题 输入一个字符,判断该字符是字母字符、数字字符还是其他字符,并做相应显示。
3个回答
展开全部
if instr("abcdef....zA....Z",i)>0 then
msgbox i & "是英文字母"
else if instr("0123456789",i)>0 then
msgbox i & "是数字"
else
msgbox i & "是其他字符"
end if
msgbox i & "是英文字母"
else if instr("0123456789",i)>0 then
msgbox i & "是数字"
else
msgbox i & "是其他字符"
end if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
n = 0
m = 0
k = 0
l = 0
aa = 0
bb = Text1
Do Until Len(bb) = 0
aa = Asc(bb)
bb = Right(bb, Len(bb) - 1)
Print aa
If 97 <= aa And aa <= 122 Then
n = n + 1
Else
If 65 <= aa And aa <= 90 Then
m = m + 1
Else
If 48 <= aa And aa <= 57 Then
k = k + 1
Else
l = l + 1
End If
End If
End If
Loop
Print "小写字母为"; n; "个"
Print "大写字母为"; m; "个"
Print "数字为"; k; "个"
Print "特殊符号为"; l; "个"
End Sub
n = 0
m = 0
k = 0
l = 0
aa = 0
bb = Text1
Do Until Len(bb) = 0
aa = Asc(bb)
bb = Right(bb, Len(bb) - 1)
Print aa
If 97 <= aa And aa <= 122 Then
n = n + 1
Else
If 65 <= aa And aa <= 90 Then
m = m + 1
Else
If 48 <= aa And aa <= 57 Then
k = k + 1
Else
l = l + 1
End If
End If
End If
Loop
Print "小写字母为"; n; "个"
Print "大写字母为"; m; "个"
Print "数字为"; k; "个"
Print "特殊符号为"; l; "个"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询