//Nathanael Schwartz CS1A Chapter 4, P. 220, #4
//
/*******************************************************************************
*
* DETERMINE LARGER AND SMALLER RECTNGLE AREAS
* ______________________________________________________________________________
* This program asks the user the leangth and width of two different rectangles.
* The program determines which rectangle has a larger area or if the rectangles
* have the same area.
*
* Computations are Based on the Formula:
* area1 = length1 * width1
* area2 = length2 * width2
* ______________________________________________________________________________
* Input
* length1 : the first length entered by the user
* width1 : the first width entered by the user
* length2 : the second length entered by the user
* width2 : the second width entered by the user
*
* Output
* area1 : the first area
* area2 : the second area
*
*******************************************************************************/
#include <iostream>
using namespace std;
int main() {
float length1; //INPUT - the first length
float width1; //INPUT - the first width
float length2; //INPUT - the second length
float width2; //INPUT - the sencond width
float area1; //OUTPUT - the first area
float area2; //OUTPUT - the second area
// Ask the user for the lengths and widths
cin >> length1;
cout << "The first length is " <<length1 <<"m\n";
cin >> width1;
cout << "The first width is " <<width1 <<"m\n";
cin >> length2;
cout << "The second length is " <<length2 <<"m\n";
cin >> width2;
cout << "The second width is " <<width2 <<"m\n";
// Calculate the areas
area1 = width1 * length1;
area2 = width2 * length2;
// Determine which area is larger
if (area1 > area2)
{
cout << "The lareger area is the first area at " <<area1 <<"m squared\n";
}
else if (area2 > area1)
{
cout << "The lareger area is the second area at " <<area2;
cout <<"m squared\n";
}
else
{
cout << "The areas are equal at " <<area1 <<"m squared\n";
}
return 0;
}