//Nathanael Schwartz CS1A Chapter 4, P. 220, #1
//
/*******************************************************************************
*
* DETERMINE SMALLER AND LARGER NUMBER
* ______________________________________________________________________________
* This program asks the user two numbers and determines which one is larger and
* smaller.
* ______________________________________________________________________________
* Input
* number1 : the first number entered by the user
* number2 : the second number entered by the user
*
* Output
* largerNumber : the number greater than the other
* smallerNumber : the number less than the other
*
*******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
float number1; //INPUT - the first number entered
float number2; //INPUT - the second number entered
float largerNumber; //OUTPUT - the larger number
float smallerNumber; //OUTPUT - the smaller number
// Ask the user to input the numbers
cin >> number1;
cout << "The first number you entered is: " <<number1 << endl;
cin >> number2;
cout << "The second number you entered is: " <<number2 << endl;
// Determine which number is larger and which is smaller
if (number1 > number2)
{
largerNumber = number1;
smallerNumber = number2;
cout << "The larger number is " <<largerNumber << endl;
cout << "The smaller number is " <<smallerNumber << endl;
}
else if (number2 > number1)
{
largerNumber = number2;
smallerNumber = number1;
cout << "The larger number is " <<largerNumber << endl;
cout << "The smaller number is " <<smallerNumber << endl;
}
else
{
cout << "Both numbers are equal to " <<number1 << endl;
}
return 0;
}