<%
dim numamt, nummax, nummin, ar(100), tmp, ii
numamt = 5 : nummax = 100 : nummin = 50
response.write("Before sorted by new selection sort<br>")
randomize
for i = 1 to numamt
ar(i) = int(nummin + (rnd * ( nummax - nummin + 1 )))
response.write( i & " : " & ar(i) & "<br>")
next
for i = 1 to numamt - 1
ii = i
xar = ar(i)
for j = i + 1 to numamt
if ar(j) < xar then
ii = j
xar = ar(j)
end if
next
ar(ii) = ar(i)
ar(i) = xar
next
response.write("<hr>After sorted by new selection sort<br>")
for i = 1 to numamt
response.write( i & " : " & ar(i) & "<br>")
next
%>
จำนวน : 26 บรรทัด