//Devin Scheu CS1A Chapter 4, P. 220, #1
//
/**************************************************************
*
* DETERMINE MINIMUM AND MAXIMUM OF TWO NUMBERS
* ____________________________________________________________
* This program asks the user to enter two numbers and uses the
* conditional operator to determine which is the smaller and
* which is the larger.
*
* Computation is based on the conditional operator:
* smaller = (num1 < num2) ? num1 : num2
* larger = (num1 > num2) ? num1 : num2
* ____________________________________________________________
* INPUT
* num1 : First number entered by the user (as a double)
* num2 : Second number entered by the user (as a double)
*
* OUTPUT
* smaller : The minimum value
* larger : The maximum value
*
**************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
//Variable Declarations
double num1; //INPUT - First number entered by the user (as a double)
double num2; //INPUT - Second number entered by the user (as a double)
double smaller; //PROCESSING - The smaller of the two numbers
double larger; //PROCESSING - The larger of the two numbers
//Prompt for Input
cout << "Enter the first number: ";
cin >> num1;
cout << "\nEnter the second number: ";
cin >> num2;
//Determine Smaller and Larger Using Conditional Operator
smaller = (num1 < num2) ? num1 : num2;
larger = (num1 > num2) ? num1 : num2;
//Output Result
cout << fixed << setprecision(2);
cout << "\n";
cout << left << setw(25) << "Smaller Number:" << right << setw(15) << smaller << endl;
cout << left << setw(25) << "Larger Number:" << right << setw(15) << larger << endl;
} //end of main()