//Angel Lugo CSC5 Chapter 4, P. 220, #4
//
/**************************************************************
*
* COMPUTE THE AREA OF TWO RECTANGLES AND COMPARE THEM
* ____________________________________________________________
* This program computes the area of two rectangles
* and compares which rectangle has the greater area
* or if the areas are the same.
*
* Computation is based on:
* The user's input on the length and width
* entered for each rectangle.
* ____________________________________________________________
* INPUT
* lengthOne: Length inputed by user for rectangle one
* widthOne : width inputed by user for rectangle one
* lengthTwo: Length inputed by user for rectangle two
* widthTwo : width inputed by user for rectangle two
*
* OUTPUT
* areaOne : Area of rectangle one
* areaTwo : Area of rectangle two
*
**************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
//
// Declare variables to store inputs
float lengthOne;
float widthOne;
float lengthTwo;
float widthTwo;
float areaOne;
float areaTwo;
//
// Display information in "cout"
cout << "Area comparison of two rectangles" << endl;
//
// Display information in "cout" and store user's input in "cin" for variable
cout << "What is the length of the first rectangle? ";
cin >> lengthOne;
cout << "\nWhat is the width of the first rectangle? ";
cin >> widthOne;
//
// Calculate area for rectangle one
areaOne = lengthOne * widthOne;
cout << "\nArea one: " << areaOne;
//
// Display information in "cout" and store user's input in "cin" for variable
cout << "\n\nWhat is the length of the second rectangle? ";
cin >> lengthTwo;
cout << "\nWhat is the width of the second rectangle? ";
cin >> widthTwo;
//
// Calculate area for rectangle two
areaTwo = lengthTwo * widthTwo;
cout << "\nArea two: " << areaTwo;
//
// Check is are one is greater then area two
if (areaOne > areaTwo)
{
cout << "\n\nThe first reactangle has a greater area then the second reactangle.";
}
//
// Check is are two is greater then area one
if (areaOne < areaTwo)
{
cout << "\n\nThe second reactangle has a greater area then the first reactangle.";
}
//
// Check if both areas are equal
if (areaOne == areaTwo)
{
cout << "\n\nThe two rectangles have equal areas.";
}
return 0;
}