//--------------------------------------------------------------------
// ptarray.cpp
//--------------------------------------------------------------------

// Array of objects example
#include <iostream.h> #include "point2.h"
//--------------------------------------------------------------------
void main () { const int MAX_NUM_POINTS = 5; // Maximum number of points Point pt[MAX_NUM_POINTS]; // Array of points int inputX, // Input x- and y-coordinates inputY, j; // Loop counter
// Read in the coordinate pairs. for ( j = 0 ; j < MAX_NUM_POINTS ; j++ ) { cout << "Enter the coordinates for pt[" << j << "]: "; cin >> inputX >> inputY; pt[j].setXY(inputX,inputY); } }