题型:综合题 题类:模拟题 难易度:普通
浙江省2019年信息技术选考模拟试卷四
查找的英文单词由连续的ASCII英文字符(a~z或A~Z)组成。组合词程序会进行分解,如river-small可拆分为2个单词river和small,查找的英文单词不区分大小写。程序代码如下,但加框处代码有错,请改正:
Private Sub Command1_Click()
Dim article As String,f As String,count As Integer
Dim i As Intege,,begin As Integer,s As String
article=Text1.Text : f=Text2.Text : count=0
begin = 1
For i=1 To Len(article)
t = Mid(article,i,1)
If Not(t>="A"And t<="Z" Or t>="a" And t<="z") Then
If i > begin Then
s = '①
If LowerCase(f)=LowerCase(s) Then
count = count+1
End If
End If
begin = i + 1
End If
Next i
Text3.Text=Str(count)
End Sub
Function LowerCase(word As String) As String '单词转化为全小写的形式
Dim i As Integer,c As String
For i=1 To Len(word)
c = Mid(word,i,1)
'小写英文字母的ASCII码值比大写字母的值大32
If c>="A" And c<="Z" Then c = '②
LowerCase = LowerCase + c
Next i
End Function
以上程序段运行时,为了实现上述功能,加框处代码应改正为:
①;②。
试题篮