Description
Define a Rectangle class that provides getLength and getWidth. Using the findMax routine given below, write a main that creates an array of Rectangle and finds the largest Rectangle first on the basis of area and then on the basis of perimeter.
#include <iostream>
#include <vector>
#include <string>
#include <strings.h>
using namespace std;
// Generic findMax, with a function object, C++ style.
// Precondition: a.size( ) > 0.
template <typename Object, typename Comparator>
const Object & findMax( const vector<Object> & arr, Comparator isLessThan )
{
int maxIndex = 0;
for( int i = 1; i < arr.size( ); ++i )
if( isLessThan( arr[ maxIndex ], arr[ i ] ) )
maxIndex = i;
return arr[ maxIndex ];
}

