编写一个VB程序,判断某字符串是否为回文字符串。所谓回文字符串,指一个字符串从左往右读和从右往左读是完全一样的。程序运行时,单击“判断”按钮后,在标签Label2中显示判断结果。程序运行效果如图所示。
实现上述功能的程序如下,请回答下列问题:
Private Sub Com1_Click( )
Dim s As String
Dim flag As Boolean
Dim n As Integer, i As Integer
s = Text1.Text
_________ ‘①
flag = True
i = 1
Do While i <= n \ 2
If Mid(s, i, 1) < >________________ Then ‘②
flag = False
Exit Do '退出Do循环
End If
i = i + 1
Loop
If flag Then
Label2.Caption = s + "是回文字符串"
Else
Label2.Caption = s + "不是回文字符串"
End If
End Sub