[求助]算次小值遇到的问题?
Private Sub dminCommand_Click()Dim A(14), min, dmin As Double
Dim i, n As Integer
n = numberInput.Text
A(0) = txtInput1.Text
A(1) = txtInput2.Text
A(2) = txtInput3.Text
A(3) = txtInput4.Text
A(4) = txtInput5.Text
A(5) = txtInput6.Text
A(6) = txtInput7.Text
A(7) = txtInput8.Text
A(8) = txtInput9.Text
A(9) = txtInput10.Text
A(10) = txtInput11.Text
A(11) = txtInput12.Text
A(12) = txtInput13.Text
A(13) = txtInput14.Text
A(14) = txtInput15.Text
min = A(0)
For i = 0 To n - 1
If A(i) < min Then
min = A(i)
End If
Next i
If A(0) = min Then
If A(1) = min Then
If A(2) = min Then
If A(3) = min Then
If A(4) = min Then
If A(5) = min Then
If A(6) = min Then
If A(7) = min Then
If A(8) = min Then
If A(9) = min Then
If A(10) = min Then
If A(11) = min Then
If A(12) = min Then
If A(13) = min Then
If A(14) = min Then
dmin = 0
Else: dmin = A(14)
End If
Else: dmin = A(13)
End If
Else: dmin = A(12)
End If
Else: dmin = A(11)
End If
Else: dmin = A(10)
End If
Else: dmin = A(9)
End If
Else: dmin = A(8)
End If
Else: dmin = A(7)
End If
Else: dmin = A(6)
End If
Else: dmin = A(5)
End If
Else: dmin = A(4)
End If
Else: dmin = A(3)
End If
Else: dmin = A(2)
End If
Else: dmin = A(1)
End If
Else: dmin = A(0)
End If
For i = 0 To n - 1
If A(i) <> min Then
If A(i) < dmin Then
dmin = A(i)
End If
End If
Next i
dminOutput.Text = dmin
End Sub
我的次小值总是等于最小值,这是为什么啊?谢谢!
[此贴子已经被作者于2006-10-23 13:44:39编辑过]