Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main () {
- int number1, // The first number the user inputs
- number2, // The second number the user inputs
- number3; // The third number the user inputs
- cout << "Welcome to the order numbers program" << endl;
- cout << "Please enter in a number...";
- cin >> number1;
- cout << "Please enter in a number...";
- cin >> number2;
- cout << "Please enter in a number...";
- cin >> number3;
- if (number1 == number2 && number2 == number3){ // If all 3 numbers are equal
- cout << "All the numbers are equal." << endl;
- }
- else if (number1 <= number2 && number1 <= number3) { // If the first number is the smallest
- if (number2 <= number3) { // If the first number is the smallest and the third number is the largest
- cout << number1 << endl;
- cout << number2 << endl;
- cout << number3 << endl;
- } else if (number3 <= number2) { // if the first number is the smallest and the second number is the largest
- cout << number1 << endl;
- cout << number3 << endl;
- cout << number2 << endl;
- }
- } else if (number2 <= number1 && number2 <= number3) { // If the second number is the smallest
- if (number1 <= number3) { // If the second number is the smallest and the third number is the largest
- cout << number2 << endl;
- cout << number1 << endl;
- cout << number3 << endl;
- } else if (number3 <= number1) { // If the second number is the smallest and the first number is the largest
- cout << number2 << endl;
- cout << number3 << endl;
- cout << number1 << endl;
- }
- } else if (number3 <= number1 && number3 <= number2) { // If the third number is the smallest
- if (number1 <= number2) { // If the third number is the smallest and the second number is the largest
- cout << number3 << endl;
- cout << number1 << endl;
- cout << number2 << endl;
- } else if (number2 <= number1) { // If the third number is the smallest and the first number is the largest
- cout << number3 << endl;
- cout << number2 << endl;
- cout << number1 << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement