// Chapter 4 - Programming Challenge #4
// Areas of Rectangles
// This program asks the user for the length and width
// of two rectangles. It calculates the area of each
// rectangle and determines which rectangle has the
// greater area, or if both areas are equal.

#include <iostream>
using namespace std;

int main()
{
    // Variables for rectangle 1
    double length1, width1;

    // Variables for rectangle 2
    double length2, width2;

    // Variables to store the calculated areas
    double area1, area2;

    // Get the dimensions of rectangle 1
    cout << "Enter the length of rectangle 1: ";
    cin >> length1;

    cout << "Enter the width of rectangle 1: ";
    cin >> width1;

    // Get the dimensions of rectangle 2
    cout << "Enter the length of rectangle 2: ";
    cin >> length2;

    cout << "Enter the width of rectangle 2: ";
    cin >> width2;

    // Calculate the area of each rectangle
    area1 = length1 * width1;
    area2 = length2 * width2;

    // Compare the two areas
    if (area1 > area2)
    {
        cout << "Rectangle 1 has the greater area." << endl;
    }
    else if (area2 > area1)
    {
        cout << "Rectangle 2 has the greater area." << endl;
    }
    else
    {
        cout << "Both rectangles have the same area." << endl;
    }

    return 0;
}