RosettaCodeData/Task/Sort-three-variables/FreeBASIC/sort-three-variables.basic

27 lines
475 B
Plaintext

#macro sort_three( x, y, z )
if x>y then swap x, y
if y>z then swap y, z
if x>y then swap x, y
#endmacro
'demonstrate this for strings
dim as string x = "lions, tigers, and"
dim as string y = "bears, oh my!"
dim as string z = "(from the ""Wizard of OZ"")"
sort_three(x,y,z)
print x
print y
print z : print
'demonstrate this for signed integers
dim as integer a = 77444
dim as integer b = -12
dim as integer c = 0
sort_three(a,b,c)
print a
print b
print c