Numbers In Rising Order

Hey guys!
I need a program that takes in 3 numbers and outputs them in a rising order, you put 3 2 1, and it outputs 1 2 3. Im getting a hard time with the combinations...
if someone have an example that would help me, it would be great.

This is what i got so far..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>

using namespace std;

int main()
{

	while (true)
	{
		int a, b, c;

		cout << "Enter 3 numbers\n";
		cin >> a >> b >> c;
		//a=b=c
		if (a == b&&a == c)
			cout << a << b << c << endl;
		//a=b<c
		if (a == b&&a < c)
			cout << a << b << c << endl;
		//a>b=c
		if (a > b&&b == c)
			cout << c << b << a << endl;
		//a<b<c
		if (c > b&&b > a)
			cout << a<<"-->" << b << "-->" << c << "-->" << endl;
		//c<a<b
		if (b > a&&a > c)
			cout << c << "-->" << a << "-->" << b << "-->" << endl;
		//c<b<a
		if (a > b&&b > c)
			cout << c << "-->" << b << "-->" << a << "-->" << endl;
		//b<a<c
		if (a > b&&a < c)
			cout << b << "-->" << a << "-->" << c << "-->" << endl;
		//a<c<b
		if (b > a&&b > c)
			cout << a << c << b << endl;
		//c<a<b
		if (a>c&&b > c)
			cout << c << a << b << endl;

	}
	return 0;
}
Topic archived. No new replies allowed.