题目

小王编写了一个寻找最长连续相同子串的程序,功能如下:在文本框Text1中输入一个字符串,点击“查找最长子串”按钮后,在标签Label1上显示出最长子串的长度。程序运行如图所示。 (1) 根据题意,“查找最长子串”按钮的对象名为。 (2) 请在划线处填入合适的代码。 Private Sub cmd1_Click() Dim i As Integer, n As Integer Dim max As Integer, count As Integer Dim s As String s = Text1.Text n = count = 1: max = 1 For i = 2 To n If  Then count = count + 1 Else If count > max Then max = count End If count =  End If Next i   Label1.Caption = "最长连续子串字符数为:" + Str(max) End Sub (3) 若删除加框处的代码,在Text1中输入“AAAbbcd00000”,则程序结果是(填写数字) 答案: 【1】cmd1 【1】len(s)【2】mid(s,i,1)=mid(s,i-1,1)【3】1 【1】3
信息技术 试题推荐
最近更新