home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
euphoria
/
simple.ex
< prev
next >
Wrap
Text File
|
1994-01-31
|
561b
|
24 lines
--------------------------------
-- A very simple sort program --
--------------------------------
with trace -- compile for tracing
trace(1) -- turn on tracing
function simple_sort(sequence x)
object temp
for i = 1 to length(x) - 1 do
for j = i + 1 to length(x) do
if compare(x[j],x[i]) < 0 then
temp = x[j]
x[j] = x[i]
x[i] = temp
end if
end for
end for
return x
end function
-- Hold down the Enter key and
-- watch x get sorted before your eyes!
? simple_sort( {9, 10, 3, 1, 4, 5, 8, 7, 6, 2} )