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.
#include<iostream>
usingnamespace 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;
}