Sort three variables: Difference between revisions

Content added Content deleted
(Added Easylang)
Line 298: Line 298:
+0
+0
+77444</pre>
+77444</pre>

=={{header|Amazing Hopper}}==
<syntaxhighlight lang="c">

#include <basico.h>

algoritmo

x = 77444, y = -12.5, z = 0
low=x, midd=y, high=z
imprimir("BEFORE:\nX = ",x, " Y = ",y, " Z = ",z,NL)
#basic{
x = min( min( low,midd),high)
z = max( max( low,midd),high)
y = low + midd + high - x - z
}

imprimir("\nAFTER:\nX = ",x, " Y = ",y, " Z = ",z,NL,NL)

x = "lions, tigers, and"
y = "bears, oh my!"
z = "(from the \"Wizard of OZ\")"
imprimir("BEFORE:\nX = ",x, "\nY = ",y, "\nZ = ",z,NL)
#(x > y), entonces { intercambiar( x,y) }
#(y > z), entonces {
intercambiar (y,z )
#(x > y), entonces { intercambiar( x,y ) }
}

imprimir("\nAFTER:\nX = ",x, "\nY = ",y, "\nZ = ",z,NL,NL)

p = {}
'"lions, tigers, and",77444,"bears, oh my!",-12.7,0,"(from the \"Wizard of OZ\")"'
enlistar en 'p'

fijar separador 'NL'
imprimir("BEFORE:\n",p,NL)
matriz.ordenar(p)
imprimir("\nAFTER:\n",p,NL)


terminar
</syntaxhighlight>
{{out}}
<pre>
$ hopper3 basica/sort3var.bas
BEFORE:
X = 77444 Y = -12.500000 Z = 0

AFTER:
X = -12.500000 Y = 0.000000 Z = 77444.000000

BEFORE:
X = lions, tigers, and
Y = bears, oh my!
Z = (from the "Wizard of OZ")

AFTER:
X = (from the "Wizard of OZ")
Y = bears, oh my!
Z = lions, tigers, and

BEFORE:
lions, tigers, and
77444
bears, oh my!
-12.700000
0
(from the "Wizard of OZ")

AFTER:
(from the "Wizard of OZ")
bears, oh my!
lions, tigers, and
-12.700000
0
77444

</pre>


=={{header|APL}}==
=={{header|APL}}==