//******************************************************************* // // Program: Area/perimeter comparisons // // Author: R. Rosebrugh, rrosebrugh@mta.ca // // Description: Compares the area of one rectangle with the perimeter // of another. // // Date: 1999/9/26 // // Filename: areaperim.cpp // //******************************************************************* #include #include "rect.h" void main() { double inLength, // length of rectangle inWidth; // width of rectangle cout << "Enter the length and width of the first rectangle (eg 34.5 56.7)> " << endl; cin >> inLength >> inWidth; Rectangle rect1(inLength, inWidth); cout << endl; cout << "Enter the length and width of the second rectangle > " << endl; cin >> inLength >> inWidth; Rectangle rect2(inLength, inWidth); if (rect1.area() > rect2.area()) { cout << endl << "The first has the larger area: " << rect1.area() << endl; cout << "The perimeter of the second is: " << rect2.perimeter() << endl; } else { cout << endl << "The second has the larger area:" << rect2.area() << endl; cout << "The perimeter of the first is:" << rect1.perimeter() << endl; } }