题目

小禾编写了一个VB程序,功能如下:在文本框Text1中输入英语文章,并在文本框Text2中输入要查找的英语单词,单击“开始查找”按钮Command1后,在文本框Text3中显示英语文章中出现该单词的次数,在文本框Text4中显示该单词在英语文章中两次出现的最大间距,程序运行界面如下图所示。请回答以下问题: Private Sub Command1_Click()     Dim a(1 To 1000) As Integer         '数组a存储文中出现该指定单词的各个位置     Dim s, c, ch As String     Dim n, max, i As Integer     s = Text1.Text        ①       n = 0     max = 0     For i = 1 To Len(s) - Len(c) + 1         ch =    ②           If ch = c Then             n = n + 1                ③               If n >= 2 Then                 If a(n) - a(n - 1) - Len(c) > max Then max = a(n) - a(n - 1) - Len(c)             End If         End If     Next i     Text3.Text = Str(n)     Text4.Text = Str(max) End Sub (1) 该应用程序中共有个对象组成,分别属于类控件 (2) 请将横线处的语句补充完整 ① ② ③  答案: 【1】10【2】4 【1】c=text2.text【2】mid(s,i,len(c))【3】a(n)=i
信息技术 试题推荐