题型:综合题 题类:模拟题 难易度:困难
浙江省杭州市2016年信息技术高考模拟卷十二
程序运行时,在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
回答下列问题:
试题篮