高校等考试题天天练二级VB]10月28日
分类: 计算机
时间: 2022-09-18 08:26:06
作者: 全国等级考试资料网
知识点:程序填空(五)
下面事件过程用来统计指定字符串中26个英文字母(不区分大小写)各自出现的次数。请填空完善它。
Private Sub Command1_Click()
Dim s As String
Dim m(25) As Integer
s = InputBox("请输入指定的字符串:")
For k = 1 To [ (7) ]
c = [ (8) ](Mid$(s, k, 1))
If c <= "Z" And c >= "A" Then
n = Asc(c) - Asc("A")
m(n) = [ (9) ]
End If
Next k
For k = 0 To 25
Print Chr(k + Asc("A")); "---"; m(k)
Next k
End Sub
下面事件过程用来统计指定字符串中26个英文字母(不区分大小写)各自出现的次数。请填空完善它。
Private Sub Command1_Click()
Dim s As String
Dim m(25) As Integer
s = InputBox("请输入指定的字符串:")
For k = 1 To [ (7) ]
c = [ (8) ](Mid$(s, k, 1))
If c <= "Z" And c >= "A" Then
n = Asc(c) - Asc("A")
m(n) = [ (9) ]
End If
Next k
For k = 0 To 25
Print Chr(k + Asc("A")); "---"; m(k)
Next k
End Sub