Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.31 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main () {
  6.     int number1, // The first number the user inputs
  7.             number2, // The second number the user inputs
  8.             number3; // The third number the user inputs
  9.  
  10.     cout << "Welcome to the order numbers program" << endl;
  11.     cout << "Please enter in a number...";
  12.     cin >> number1;
  13.     cout << "Please enter in a number...";
  14.     cin >> number2;
  15.     cout << "Please enter in a number...";
  16.     cin >> number3;
  17.  
  18.     if (number1 == number2 && number2 == number3){ // If all 3 numbers are equal
  19.         cout << "All the numbers are equal." << endl;
  20.     }
  21.     else if (number1 <= number2 && number1 <= number3) { // If the first number is the smallest
  22.         if (number2 <= number3) { // If the first number is the smallest and the third number is the largest
  23.             cout << number1 << endl;
  24.             cout << number2 << endl;
  25.             cout << number3 << endl;
  26.         } else if (number3 <= number2) { // if the first number is the smallest and the second number is the largest
  27.             cout << number1 << endl;
  28.             cout << number3 << endl;
  29.             cout << number2 << endl;
  30.         }
  31.     } else if (number2 <= number1 && number2 <= number3) { // If the second number is the smallest
  32.         if (number1 <= number3) { // If the second number is the smallest and the third number is the largest
  33.             cout << number2 << endl;
  34.             cout << number1 << endl;
  35.             cout << number3 << endl;
  36.         } else if (number3 <= number1) { // If the second number is the smallest and the first number is the largest
  37.             cout << number2 << endl;
  38.             cout << number3 << endl;
  39.             cout << number1 << endl;
  40.         }
  41.     } else if (number3 <= number1 && number3 <= number2) { //  If the third number is the smallest
  42.         if (number1 <= number2) { // If the third number is the smallest and the second number is the largest
  43.             cout << number3 << endl;
  44.             cout << number1 << endl;
  45.             cout << number2 << endl;
  46.         } else if (number2 <= number1) { // If the third number is the smallest and the first number is the largest
  47.             cout << number3 << endl;
  48.             cout << number2 << endl;
  49.             cout << number1 << endl;
  50.         }
  51.     }
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement