[填空题] 如果存在如下过程: Private Function FMaxla() As Integer) Dim First As Integer,Last As Integer,i As In

23 查阅

[填空题] 如果存在如下过程:

Private Function FMaxla() As Integer)

Dim First As Integer,Last As Integer,i As Integer

First=LBound(a)

Last=UBound(a)

Max=a(First)

For i=First To Last

If a(i)>Max Then Max=a(i)

Next i

FMax=Max

End Function

在窗体上添加一个命令按钮,然后编写如下事件过程:

Private Sub Command_Click()

ReDim m(1 To 4)As Integer

m(1)=20:m(2)=30:m(3)=50:m(4)=100

C=FMax(m)

Print C

End Sub

单击命令按钮,其输出结果为 (8)

参考答案:

100

首先需要分析Fmax函数的数学意义,不难发现是寻找数组中的最大值。Fmax函数调用参与运算的参数是数组m,那么输出值为m数组中最大值m(4)=100。

计算机考试