填空:执行下面程序,在“输入”文本框中输入“14,5,8,19,21”后,单击“输入数组”命令按钮C
ommand1,数组元素a(2)的值是 (1) ,在单击“数组处理”命令按钮Command2后,数组元素a(1)的值变为 (2) ,a(3)的值变为 (3) 。 Option Explicit Option Base 1 Dim a() As Integer Private Sub Command1_Click() '输入数组 Dim i As Integer, j As Integer, st As String st = Text1.Text Do Until InStr(st, ",") = 0 i = InStr(st, ",") j = j + 1 ReDim Preserve a(j) a(j) = Val(Left(st, i - 1)) st = Right(st, Len(st) - i) Loop ReDim Preserve a(j + 1) a(j + 1) = Val(st) End Sub Private Sub Command2_Click() '数组处理 Dim i As Integer, t As Integer, j As Integer For i = 2 To UBound(a) If a(i) > a(1) Then t = a(i) For j = i To 2 Step -1 a(j) = a(j - 1) Next j a(1) = t End If Next i For i = 1 To UBound(a) Text2.Text = Text2.Text &Str(a(i)) Next i End Sub