题型:综合题 题类:常考题 难易度:困难
浙江省台州市书生中学2017-2018学年高二上学期信息技术第三次月考试卷
Private Sub Command1_Click()
Dim f As String, x As String, y As String
x = Text1.Text
y = Text2.Text
f = ""
If Len(x) <> Len(y) Then
Text1.Text = "请输入符合要求的字符串!"
Text2.Text = "请输入符合要求的字符串!"
Else
For i = 1 To Len(x)
If Then
f = f + Mid(y, i, 1)
Else
f = f + Mid(x, i, 1)
End If
Next i
Text3.Text = f
End Sub
长度小于等于 100),在列表框 List1 里输出所有配对括号在表达式中的位置。例如在文本框 Text1 里入:“12*(3-(1+2))*3”,程序运行效果如图所示。
实现上述功能的 VB 代码如下,在划线的地方填入合适代码,完善程序。Private Sub Command1_Click()
Dim s As String
Dim a(1 To 100) As Integer
|
i = 1 top = 0
Do While i <= Len(s)
If Mid(s, i, 1) = "(" Then
top = top + 1
{#blank#}1{#/blank#}
End If
If Mid(s, i, 1) = ")" Then
List1.AddItem Str(a(top)) + " " + Str(i)
{#blank#}2{#/blank#}
End If
i=i+1 Loop
End Sub
试题篮