Sort three variables: Difference between revisions
Content added Content deleted
imported>Arakov |
(Added Easylang) |
||
Line 903: | Line 903: | ||
BEFORE: x=[lions, tigers, and]; y=[bears, oh my!]; z=[(from the "Wizard of OZ")] |
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]</pre> |
AFTER: x=[(from the "Wizard of OZ")]; y=[bears, oh my!]; z=[lions, tigers, and]</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight lang=easylang> |
|||
proc sort3 . a b c . |
|||
if a > c |
|||
swap a c |
|||
. |
|||
if b > c |
|||
swap b c |
|||
. |
|||
if a > b |
|||
swap a b |
|||
. |
|||
. |
|||
x = 77444 |
|||
y = -12 |
|||
z = 0 |
|||
sort3 x y z |
|||
print x & " " & y & " " & z |
|||
# |
|||
proc sort3str . a$ b$ c$ . |
|||
if strcmp a$ c$ > 0 |
|||
swap a$ c$ |
|||
. |
|||
if strcmp b$ c$ > 0 |
|||
swap b$ c$ |
|||
. |
|||
if strcmp a$ b$ > 0 |
|||
swap a$ b$ |
|||
. |
|||
. |
|||
x$ = "lions, tigers, and" |
|||
y$ = "bears, oh my!" |
|||
z$ = "(from the \"Wizard of OZ\")" |
|||
sort3str x$ y$ z$ |
|||
print x$ |
|||
print y$ |
|||
print z$ |
|||
</syntaxhighlight> |
|||
=={{header|EDSAC order code}}== |
=={{header|EDSAC order code}}== |