二、填空题
1. 以下程序的功能是:用Array函数建立一个含有8个元素的数组,然后查找并输出该数组中保元素的最小值。请将程序补充完整。
Option Base 1
Private Sub Command1_Click() Dim arr1
Dim Min%, i%
arr1 = Array(12, 435, 76, -24, 78, 54, 866, 43) Min = _____①_____ For i = 2 To 8
If arr1(i) < Min Then ____②________ Next i
Print \最小值是:\End Sub
2. 以下程序的功能是:分别计算给定的10个数中正数之和与负数之和。请将程序补充完整。
Option Base 1
Private Sub Command1_Click() Dim ww
ww = Array(12, -6, 15, 34, -32, 47, 13, 9, 6, -3) s1 = 0 s2 = 0
For k = 1 To 10
If (ww(k) > 0) Then s1 = ____①_____ Else
s2 = ______②_____ End If Next k
Print \正数之和为 \ Print \负数之和为 \End Sub
3. 以下程序的功能是:程序运行后,单击窗体,在输入对话框中分别输入三个整数,程序将输出三个数中的中间数,如图3-5-1所示。请将程序补充完整。
Option Base 1
Private Sub Form_Click() Dim a(3) As Integer
Print \输入的数据是:\
图3-5-1 程序运行界面 For i = 1 To 3
49-109
a(i) = InputBox(\输入数据\ Print a(i); Next Print
If a(1) < a(2) Then t = a(1) a(1) = a(2)
a(2) =_____①_______ End If
If a(2) > a(3) Then m = a(2)
ElseIf a(1) > a(3) Then
m = ______②_______ Else
m = ______③______ End If
Print \中间数是:\End Sub
4. 以下程序的功能是:求一个3×3阶矩阵的三行中元素之和最大的那一行。请将程序补充完整。
Option Base 1
Private Sub Command1_Click() Dim ww%(3, 3), tt%(3) For i = 1 To 3 For j = 1 To 3
ww(i, j) = InputBox(\请输入数据\ Next j Next i
For k = 1 To 3 For j = 1 To 3
tt(k) = ______①_______ Next j Next k
msum = ______②_______ lmax = _______③_______ For i = 2 To 3
If tt(i) > msum Then msum = tt(i) lmax = i
50-109