Trying to sort numbers from lowest to highest
Well I'm trying to sort three integers from lowest to highest without using loops, nested if-statements, multiple statements in the if-statements, or else statements. Is this possible?
This is what I've come up with so far:
Code:
//Trying to sort numbers from lowest to highest
#include "C:\Visual C++ Projects\std_facilities_lib.h"
void main()
{
int i1; int i2; int i3;
int low; int med; int high;
cout << "Enter three integers separated by spaces:\n";
cin >> i1 >> i2 >> i3;
if (i1<i2)
if (i1<i3)
low=i1;
if (i2<i1)
if (i2<i3)
low=i2;
if (i3<i1)
if (i3<i2)
low=i3;
keep_window_open();
}
It only finds the lowest number. I don't know how to find the lower number of the next two.