Private Sub Form_Click()
Dim a%(1 To 10), i%
Print "原始数据:"
For i = 1 To 10
a(i) = Int( 【1】* 101 + 100)
Print a(i);
Next i
Call 【2】
Print "交换后:"
For i = 1 To 10
Print a(i);
Next i
End Sub
Sub jh(b%())
Dim ma%, mi%, i%, t%
ma = LBound(b)
mi = LBound(b)
For i = LBound(b) + 1 To 【3】
If 【4】Then ma = i
If b(mi) > b(i) Then 【5】
Next i
t = b(ma): b(ma) = b(mi): b(mi) = 【6】
End Sub
Rnd;Rnd() --- jh(a) --- UBound(b) --- b(ma) < b(i) --- mi = i --- t
举一反三
- 以下程序输出的结果是: Private Sub Form_Activate() Dim a a=Array(1,2,3,4,5) For i=Lbound(((A) To Ubound(((A) A(i)=i*a(i) Next i Print i, Lbound(((A) , Ubound(((A) , a(i) End Sub
- 写输出下面程序的运行结果_ _。 Dim a() As Integer Private Sub Command1_Click() ReDim a(1 To 5) For i = 1 To 5 a(i) = i Next i ReDim a(1 To 10) For i = 6 To 10 a(i) = 2 * i Next i For i = 1 To 10 Print a(i); Next i End Sub
- 以下程序的运行结果是 Sub s1(b() As Integer) For i = 1 To 4 b(i) = 2 * i Next i End Sub Private Sub Command1_Click() Dim a(1 To 4) As Integer For i = 1 To 4 a(i) = i + 5 Next i s1 a() For i = 1 To 4 Print a(i) Next i End Sub
- 下列代码执行的结果是( )。 Private Sub Form_Click() Dim a(5) Dim i as Integer For i = 1 To 5 <br/>a(i) = i + 2 Next i Print a(4) End Sub A: 6 B: 8 C: 24 D: 2
- 执行以下程序,单击命令按钮后,输出结果是______。 Private Sub Command1_Click() Dim a(5) As Integer Dim b For i = 1 To 5 a(i) = i*i Next i For Each b In a Print b; Next b End Sub
内容
- 0
Public Sub Proc(a%( )) Static i% Do a(i) = a(i) + a(i + 1) i = i + 1 Loop While i < 2 End Sub Private Sub Command1_Click( ) Dim m%, i%, x%(10) For i = 0 To 4: x(i) = i + 1: Next i For i = 1 To 2: Call Proc(x): Next i For i = 0 To 4: Print x(i);: Next i End Sub A: 3 4 7 5 6 B: 3 5 7 4 5 C: 2 3 4 4 5 D: 4 5 6 7 8
- 1
阅读程序: Option Base 1 Sub P(b() As Integer) For i=1 To 4 b(i)=2*i Next i End Sub Private Sub Form_Click() Dim a(4)As Integer For i=1 To 4 a(i)=i+4 Next i P a For i=1 To 4 Print a(i) Next i End Sub 运行上面的程序,单击窗体,输出结果为 A: 2 4 6 8 B: 5 6 7 8 C: 10 12 14 16 D: 4 8 12 16
- 2
下列程序: Option Base 1 Private Sub Form_Click() Dim a(5,5) For i = 1 To 5 For j = 1 To 5 k = k + 1 a (i,j)= k Next j Next i For i = 1 To 5 s = s + a (i,i) Next i Print s End Sub 运行时的输出结果是( )。
- 3
下列程序的运行结果为( )。 Private Sub Command1_Click() Dim a(5) As String Dim i As Integer For i = 0 To 5 a(i) = i + 1 Print a(i); Next i End Sub
- 4
下列程序运行后输出结果是_______. Private Sub Form_Click() K=1 For I=5 to 1 step -1 T=T*10 + K S=S+T Next I Print S End sub