【加试题】小明编写了一个VB应用程序,用于统计英文字母的个数,当用户输入一行英文语句,可以统计其中每个字母出现的次数。程序运行时界面如图所示。 ![](http://tikupic.21cnjy.com/a3/45/a3454212dc3c97b75065838708eace77.png)
程序运行时,在Text1中输入字符串,单击“开始统计”按钮,在List1中显示统计结果。函数IsLetter(x)功能,若x是字母,则返回值为字母x在字母序列“A”~“Z”中的序号,如字母“A”的序号为0,字母“D”的序号为3。若x不是字母,则返回值为-1。
Function IsLetter(x As String) As Integer
If "A" <= x And x <= "Z" Then
IsLetter = Asc(x) - Asc("A")
ElseIf "a" <= x And x <= "z" Then
IsLetter = Asc(x) - Asc("a")
Else
①
End If
End Function
Private Sub Command1_Click()
Dim d(25) As Integer, m As Integer, n As Integer
Dim s As String, c As String
List1.Clear
For m = 0 To 25 '初始化数组d
d(m) = 0
Next m
s = Text1.Text
For m = 1 To Len(s) '读取字符串中的字符进行判断
c = Mid(s, m, 1)
n = IsLetter(c)
If n <> -1 Then ②
Next m
For m = 0 To 25 '输出结果
If ③ Then
List1.AddItem (Chr(m + Asc("a")) & ":" & d(m))
End If
Next m
End Sub
回答下列问题: