//Sam Partovi CS1A Chapter 4, P. 220, #1
//
/*******************************************************************************
*
* COMPARE NUMBER SIZE
* ____________________________________________________________
* This program receives two numbers and evaluates them to determine which
* number is the smallest and which number is the largest.
* ____________________________________________________________
* INPUT
*
* initialNumber : The first number to be compared
* secondNumber : The second number to be compared
*
******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
double initialNumber;
double secondNumber;
//Prompt user for initialNumber and secondNumber
cout << "Enter a number: ";
cin >> initialNumber;
cout << "\nEnter another number: ";
cin >> secondNumber;
cout << right << "\n-----------------------\n";
//Evaluate minimum and maximum number
if (initialNumber > secondNumber) {
cout << "The larger number is " << initialNumber <<
" and the smaller number is " << secondNumber;
}
else if (secondNumber > initialNumber) {
cout << "The larger number is " << secondNumber <<
" and the smaller number is " << initialNumber;
}
else if (initialNumber == secondNumber) {
cout << initialNumber << " is equal to " << secondNumber << endl;
}
else {
cout << "Error in evaluating number size.\n";
}
return 0;
}