填空题 执行下列程序,单击按钮Command1,窗体第一行显示的结果是 1,UBound(A)的结果为 2,A(2)的值是 3
Option Base 1
Option Explicit
Private Sub Command1_Click()
Dim st As String, i As Integer
Dim A()As String, j As Integer, k As Integer
st="basic"
Process st
Print st
For i=1 To Len(st)
For j=i+1 To Len(st)
If Mid(st, i, 1)=Mid(st, j, 1)Then Exit For
Next
If i>Len(st)Then
k=k+1
ReDim Preserve A(k)
A(k)=Mid(st, i, 1)
Print"A("; k; ")="; A(k)
End If
Next
End Sub
Private Sub Process(S As String)
Dim i As Integer, t As String
For i=1 To Len(S)/2
t=Mid(S, i, 1)
Mid(S, i, 1)=Mid(S, Len(S)-i+1, 1)
Mid(S, Len(S)-i+1, 1)=t
Next
End Sub
【正确答案】
【答案解析】csiab 5 i