//Zachary Abdollahi CS1A Chapter 4, P. 220, #1
//
/*******************************************************************************
*
* COMPARING MIN VS MAX
*______________________________________________________________________________
* This program compares two numbers that are inputted by the user. The program
* uses a conditional operator to determine which number is smaller and which
* one is larger.
*______________________________________________________________________________
* INPUT
* num1 : First number entered by the user
* num2 : Second number entered by the user
*
* OUTPUT
* smaller : The smaller of the two numbers entered
* larger : The larger of the two numbers entered
*
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
double num1; //INPUT - First number entered by the user
double num2; //INPUT - Second number entered by the user
double smaller; //OUTPUT - The smaller of the two numbers
double larger; //OUTPUT - The larger of the two numbers
// Get input from the user
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
// Use the conditional operator to determine smaller and larger
smaller = (num1 < num2) ? num1 : num2;
larger = (num1 < num2) ? num2 : num1;
// Output result
cout << "The smaller number is " << smaller << endl;
cout << "The larger number is " << larger << endl;
return 0;
}