29 lines
510 B
Plaintext
29 lines
510 B
Plaintext
randomize 0.5
|
|
N=15
|
|
dim a(N,2)
|
|
|
|
for i = 0 to N-1
|
|
a(i,1)= int(i/5)
|
|
a(i,2)= int(rnd(1)*5)
|
|
next
|
|
|
|
print "Unsorted by column #2"
|
|
print "by construction sorted by column #1"
|
|
for i = 0 to N-1
|
|
print a(i,1), a(i,2)
|
|
next
|
|
|
|
sort a(), 0, N-1, 2
|
|
print
|
|
|
|
print "After sorting by column #2"
|
|
print "Notice wrong order by column #1"
|
|
for i = 0 to N-1
|
|
print a(i,1), a(i,2),
|
|
if i=0 then
|
|
print
|
|
else
|
|
if a(i,2) = a(i-1,2) AND a(i,1) < a(i-1,1) then print "bad order" else print
|
|
end if
|
|
next
|