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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

#include<iostream>
#include<conio.h> //load dem libraries
using namespace std;
double sort3 (double first, double second, double third); //declare the sort function
double first;
double second;
double third; //declare variables
int order[3];
int main()
{
cout << "Hello, please input three integers" << endl; //ask for 3 integers to be sorted
cin >> first, second, third; //input them
double get = sort3 (first, second, third); //assign the returned value to a useable value
cout << "The order is " <<get; //output the order
getch(); //do not killself
}
double sort3 (double first, double second, double third) //the sort function
{
if (first <= second && second <= third) //these are all conditions to see what the order of the integers will be
{
order[0,1,2] = first, second, third; //123
return order[0,1,2];
}
else if (first <= third && third <= second)
{
order[0,1,2] = first, third, second; //132
return order[0,1,2];
}
else if (second <= first && first <= third)
{
order[0,1,2] = second, first, third; //213
return order[0,1,2];
}
else if (second <= third && third <= first)
{
cout << second, third, first; //231
return order[0,1,2];
}
else if (third <= first && first <= second)
{
order[0,1,2] = third, first, second; //312
return order[0,1,2];
}
else if (third <= second && second <= first)
{
order[0,1,2] = third, second, first; //321
return order[0,1,2];
}
}
