[填空题] 执行下面程序,在文本框Text1中输入"21 23 2 3 5 17 54#"后,单击命令按钮Cmdl,数组元素A(1)的值是(),A(3)的值是(),A(5)的值是(
16 查阅
[填空题] 执行下面程序,在文本框Text1中输入"21 23 2 3 5 17 54#"后,单击命令按钮Cmdl,数组元素A(1)的值是(),A(3)的值是(),A(5)的值是().Option ExplicitPrivate Sub Cmd1_Click()Dim A() As Integer,K As IntegerDim L As Integer,S As StringS=Text1DoK=K+1ReDim Preserve A(K)L=InStr(S," ")If L<>0 ThenA(K)=Val(Left(S,L-1))S=Right(S,Len(S)-L)ElseA(K)=Val(S)End IfLoop Until L=0Call Exchang(A)For K=1 To 7Text2=Text2 &A(K) & " "Next KEnd SubPrivate Sub Exchang(A() As Integer)Dim i As Integer,Tem As IntegerDim Point1 As IntegerPoint1=1For i=1 To UBound(A)If A(i) Mod 3 =0ThenTem=A(i)A(i)=A(Point1)A(Point1)=TemPoint1=Point1+1End IfNext iEnd Sub
参考答案: