类型:操作题 难度系数:0.15 所属科目:高中信息技术

小王设计“模拟撤销”程序,需要用一个“历史记录”,“历史记录”是在对字符串s进行插入或删除时,将每步操作信息依次存储得到的,操作信息由操作符(“+”表示插入,“-”表示删除)、操作位置和操作字符串(只包含英文字母)构成,例如,“+23abc”表示在字符串s第23个位插入了“abc”,“模拟撤销”过程按照“历史记录”的逆序进行,将字符串s的内容恢复到初始状态。对字符串“Book”的操作与撤销过程,如下图所示。

小王编写的“模拟撤销”VB程序如下,文本框 Text1中的内容是撤销前字符串,文本概Text2中的内容是历史记录,单击“撤销”按钮Command1后,在标签Label1中显示撤销过程,程序运行界面如由下图所示。
 
(1)实观上述功能的VB程序如下,在程序中出现的对象没有Caption属性的是______ 。(选填,填字码:
A.Label1B.Command1C.Text1和Text2)
(2)请在划线处填入合适代码。
Private Sub Command1_Click()
Dim s As String, t As String, ch As String
Dim c As String, num As String, ss As String
Dim n As Integer, i As Integer
s = Text1.Text: t = Text2.Text
c = "": num = "": ss = s
For i = Len(t) To 1 Step -1
___________________ 
If ch >= "a" And ch <= "z" Or ch >= "A" And ch = "Z" Then
c = ch + c
ElseIf ch >= "0" And ch <= "9" Then
num = ch + num
Else
n = Val(num)     
If ch = "-" Then
s = Mid(s, 1, n - 1) + ____________________________  
Else
s = Mid(s, 1, n - 1) + Mid(s, n + Len(c), Len(s) - n - Len(c) + 1)
End If
ss = ss + "→" + s
c = "": num = ""
End If
Next i
Label1.Caption = ss
End Sub
(3)运行该程序,若文本框Text1中的内容是“April”,文本框Text2中的内容是“-3p+3ri-6e”,单击撤销按钮,For循环语句执行完成后,字符串s的值是_____________。

学霸推荐