#include <iostream>
using namespace std;
int main()
{
string enter1, enter2, enter3;
int num1, num2, num3;
cout << "Enter integer number 1: ";
cin >> enter1;
cout << "Enter integer number 2: ";
cin >> enter2;
cout << "Enter integer number 3: ";
cin >> enter3;
num1 = atoi(enter1.c_str());
num2 = atoi(enter2.c_str());
num3 = atoi(enter3.c_str());
int temp;
if (num2 <= num1)
{
temp = num2;
num2 = num1;
num1 = temp;
}
if (num3 <= num1)
{
temp = num3;
num3 = num1;
num1 = temp;
}
if (num3 <= num2)
{
temp = num3;
num3 = num2;
num2 = temp;
}
cout << "\nsorted numbers: "<<"\nnum1: " << num1 << "\nnum2: " << num2 << "\nnum3: " << num3;
}
Comments
Leave a comment