数组排序问题:如何得到最高分与最低分?
大可山人
博客专家认证 2003-05-17 12:59:40 <%@ page language="VB" debug="true"%>
<Script Language="VB" Runat="Server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim Scores(4,3) As Integer
Scores(0, 0) = 85 : Scores(0, 1) = 90: Scores(0, 2) = 88: Scores(0, 3) = 88
Scores(1, 0) = 91 : Scores(1, 1) = 93: Scores(1, 2) = 90: Scores(1, 3) = 88
Scores(2, 0) = 77 : Scores(2, 1) = 86: Scores(2, 2) = 100: Scores(2, 3) = 88
Scores(3, 0) = 70 : Scores(3, 1) = 88: Scores(3, 2) = 65: Scores(3, 3) = 88
Scores(4, 0) = 73 : Scores(4, 1) = 82: Scores(4, 2) = 76: Scores(4, 3) = 88
'以上数组对应多个学生的各科成绩。
Dim I,J,temp As Integer
For I = 0 To UBound(Scores,1)
Response.Write("第" & I+1 & "个学生的总分为")
For J=0 To UBound(Scores,2)
temp=temp+Scores(I,J)
Next
Response.Write(temp.ToString & "<Br>")
temp=0
Next
End Sub
</Script>
我想得到某学生的单科最高分与最低分,还要得到所有学生的某科的最高分与最低分,如何实现?