/* * A client for a Rectangle class that uses Points * * Mark A. Sheldon, Tufts University * Spring 2013 * */ #include #include "Point.h" #include "Rectangle.h" using namespace std; void print_rectangles(Rectangle rectangles[], int num_rectangles); int main() { /* Make an array of rectangles to play with */ Rectangle rectangles[] = { Rectangle(Point(3, 4), Point(8, 15)), /*rect 1*/ Rectangle(Point(1, 20), Point(17, 22)), /*rect 2*/ Rectangle(Point(30, 1), Point(40, 8)) /*rect 3*/ }; /* WHAT'S GOING ON HERE?? */ int num_rectangles = sizeof(rectangles) / sizeof(Rectangle); // // Tell user about the rectangles we have // cout << endl << "There are " << num_rectangles << " rectangles." << endl; print_rectangles(rectangles, num_rectangles); cout << endl; return 0; } void print_rectangles(Rectangle rectangles[], int num_rectangles) { for (int i = 0; i < num_rectangles; ++i) { rectangles[i].print(); cout << endl; } }