num(j) = InputBox("请输入数据")
Next j
Max = num(1)
For i = 1 To 10
If num(i) > Max Then
Max = num(i)
End If
Next i
Text1.Text = Max
End Sub
Private Sub Form_Load()
Command1.Caption = "最大值"
Command2.Caption = "最小值"
Text1.Text = ""
End Sub
Private Sub Command2_Click()
For j = 1 To 10
num(j) = InputBox("请输入数据")
Next j
Min = num(1)
For i = 1 To 10
If num(i) < Min Then
Min = num(i)
End If
Next i
Text1.Text = Min
End Sub
我以测试过了,vb6.0没问题!
'...求最小数min:
min=intN(0) '初始化最小为数组的第一个数
for i=1 to n-1 '循环
if intN(i)
end if
next i
'...求最大数max:
max=intN(0) '初始化最大为数组的第一个数
for i=1 to n-1 '循环
if intN(i)>max then '如果比max大就替换
max=int(i)
end if
next i
分别用 max()和min()函数