Den jeg har lavet med array kan findes her:
http://www.tjaz.dk/exp/tjektal.asp<%
Private Sub BubbleSort(byRef arrTemp, byVal sDim, byVal sSort)
Dim n
Dim y
Dim t
Dim tmpTop
Dim tmpVal
Dim iBookMark
Dim BubbleElement
BubbleElement = False
For n = 0 To UBound(arrTemp,2)
tmpTop = arrTemp(sDim,n)
iBookmark = n
For y = n To UBound(arrTemp,2)
If sSort = 0 Then
If (tmpTop > arrTemp(sDim,y)) Then
BubbleElement = True
End If
Else
If (tmpTop < arrTemp(sDim,y)) Then
BubbleElement = True
End If
End If
If BubbleElement Then
tmpTop = arrTemp(sDim,y)
iBookmark = y
BubbleElement = False
End If
Next
For t = 0 to UBound(arrTemp, 1)
tmpVal = arrTemp(t, n)
arrTemp(t, n) = arrTemp(t, iBookmark)
arrTemp(t, iBookmark) = tmpVal
Next
Next
End Sub
Function mindstetal(var1,var2,var3)
Dim myArray()
ReDim myArray(0,2)
'Her kan du skrive flere på hvis du ønsker, husk at ret antallet i ReDim myArray
myArray(0,0) = ""& var1 &""
myArray(0,1) = ""& var2 &""
myArray(0,2) = ""& var3 &""
Call BubbleSort(myArray, 0, 0)
For n = 0 To 0
Response.Write "Det mindste tal i dit array er: "& myArray(0,n) &"<br>"
Next
End Function
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
response.write mindstetal(Request.Form("tal1"),Request.Form("tal2"),Request.Form("tal3"))
else
%>
<form action="tjektal.asp" method="post">
<input type="text" name="tal1" value="" size="3">
<input type="text" name="tal2" value="" size="3">
<input type="text" name="tal3" value="" size="3">
<input type="submit" value="tjek">
</form>
<% End If %>