求最大值和最小值 编写一个求3个数中最大值Max与最小值Min的过程,然后用这个过程分别求3个数、5个数、7个数中的最大值与最小值。 Option Base 1 ' 设置数组默认下界为1 Dim m As Single, x() As Single ' 声明变量和数组 Private Sub Command1_Click(Index As Integer) Select Case Index ' 采用多分支结构 Case 0 m = 3 Case 1 m = 5 Case 2 m = 7 End Select ReDim x(m) As Single ' 重新定义数组 For n = 1 To m x(n) = Val(InputBox(" 请输入第" & n & "个数:", "请输入:", 0)) Next n Text1.Text = __________ ' 调用函数求最大值 Text2.Text = qMin(x) ' 调用函数求最小值 End Sub Private Function qMax(ByRef x() As Single) As Single qMax = x(1) For n = 1 To m If qMax Next n End Function Private Function qMin(ByRef x() As Single) As Single qMin = x(1) For n = 1 To m If qMin > x(n) Then ________ Next n End Function