怎用求最大最小值?
以下代码是导入一文本文件,有三列数据,求每列数据的平方和可如何分别求出每列数据的最大,最小值呢?
Private Sub Command1_Click()
Dim Ls() As String
Dim suju() As Single
Dim n As Double
Dim aa As String
Open "d:\ff.txt" For Input As 1
Do While Not EOF(1)
Line Input #1, aa
If aa <> "" Then
ReDim Preserve suju(2, n)
Ls = Split(aa, ",")
suju(0, n) = Val(Ls(0))
suju(1, n) = Val(Ls(1))
suju(2, n) = Val(Ls(2))
n = n + 1
End If
Loop
Close #1
For i = 0 To UBound(suju, 2)
he1 = (suju(0, i)) ^ 2 + he1
he2 = (suju(1, i)) ^ 2 + he2
he3 = (suju(2, i)) ^ 2 + he3
Next
print he1,he2,he3
End Sub