编程最大最小值
编程:连续输入N个值,直到输入非数值数据为止.请求出其中的最大值最小值.
代码.谢谢啊
Private Sub Image1_Click()
Dim Min, Max, D As Double
Dim Str As String
Dim N As Integer
N = 1
Do
Str = InputBox("请输入第" & N & "个数", "输入")
If Asc(Str) < Asc("0") Or Asc(Str) > Asc("9") Then Exit Do
D = Val(Str)
Print D
If N = 1 Then Max = D: Min = D
If Val(D) > Max Then Max = Val(D)
If Val(D) < Min Then Min = Val(D)
N = N + 1
Loop
Me.Show
Print "最大值:" & Max
Print "最小值:" & Min
Label3.Caption = Max
Label4.Caption = Min
End Sub