题型:综合题 题类:常考题 难易度:困难
浙江省慈溪市三山高级中学2018-2019学年高二下学期信息技术第一次月考试卷
图a
函数 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 f(25) As Integer, m As Integer, n As Integer
Dim s As String, c As String
List1.Clear
For m = 0 To 25 '初始化数组 f
f(m) = 0
Next m
s = Text1.Text
For m = 1 To Len(s)
c = Mid(s, m, 1) '依次读取字符串中的每个字符进行判断
②
If n <> -1 Then f(n) = f(n) + 1
Next m
For m = 0 To 25
If ③ Then '输出统计结果,没有出现的字母不输出
List1.AddItem(Chr(m + Asc(”a”)) & ”:” & f(m))
End If
Next m
End Sub
① ② ③
试题篮