You have to swap the values if they are not in ascending order. Something like :
if (x>y)
{ int tmp =x
x=y
y=tmp
}
etc...
It wasn't clear whether the you just wanted to output the numbers in ascending order, or you had to maintain the variable name as well. Seems that don't
so a simple variable swap should be OK
You get the idea...
JRM
Practically a Master Poster
621 posts since Nov 2006
Reputation Points: 130
Solved Threads: 75
All you're trying to do is output the values in order. That's not a sort.
Check if x > y. If so, move x into y and y into x (switch the values).
Then do it again for y and z.
You'll have to go back and retest x and y again.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944