
执行下列程序,单击按钮Command1,窗体第一行显示的结果是______,UBound(A)的结果为______,A(2)的值是______。 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
我们先逐步分析这段代码的执行过程。