24 lines
674 B
Plaintext
24 lines
674 B
Plaintext
arraybase 1
|
|
dim list1(5): dim list2(6): dim list3(5): dim list4(5)
|
|
list1 = {1, 2, 1, 5, 2}
|
|
list2 = {1, 2, 1, 5, 2, 2}
|
|
list3 = {1, 2, 3, 4, 5}
|
|
list4 = {1, 2, 3, 4, 5}
|
|
|
|
if Orden(list1[], list2[]) then print "list1 < list2" else print "list 1>= list2"
|
|
if Orden(list2[], list3[]) then print "list2 < list3" else print "list2 >= list3"
|
|
if Orden(list3[], list4[]) then print "list3 < list4" else print "list3 >= list4"
|
|
end
|
|
|
|
function Orden(listA[], listB[])
|
|
i = 0
|
|
l1 = listA[?]
|
|
l2 = listB[?]
|
|
while (listA[i] = listB[i]) and i < l1 and i < l2
|
|
i = i + 1
|
|
end while
|
|
if listA[?] < listB[?] then return True
|
|
if listA[?] > listB[?] then return False
|
|
return l1 < l2
|
|
end function
|