[填空题] 执行下面程序,单击命令按钮Cmd1后,a(2)的值是___(7)___,a(3)的值是___(8)___,a(5)的值是___(9)___。 Option Explicit Optio
16 查阅
[填空题] 执行下面程序,单击命令按钮Cmd1后,a(2)的值是___(7)___,a(3)的值是___(8)___,a(5)的值是___(9)___。 Option Explicit Option Base 1 Private Sub Cmd1_Click()Dim a() As Integer,i As Integer,n As IntegerDim k As Integern=8ReDim a(n)For i=1 To n a(i)=2*i-1Next ik=2Do For i=UBound(a) To 1 Step -1 If i Mod a(k)=0 Then Call delete(a,i) End If Next i k=k+1Loop Until a(k)>UBound(a)For i=1 To UBound(a) Text1=Text1 & Str(a(i)) If i Mod 5=0 Then Text1=Text1 & vbCrLfNext i End Sub Private Sub delete(a() As Integer,i As Integer)Dim k As IntegerIf i<>UBound(a) Then For k=i+1 To UBound(a) a(k-1)=a(k) Next kEnd IfReDim Preserve a(UBound(a)-1) EndSub
参考答案: