// Client code that uses a point class defined in point.h. #include #include #include "point.h" using namespace std; // returns a count of the number of points in the given vector that have x and // y values that are equal int count_equal(const vector & points) { int count = 0; for (const point & p : points) { if (p.getX() == p.getY()) { count++; } } return count; } int main() { point p1; point p2; p2.setLocation(3, 18); point p3(13, 5); cout << "p1 = " << p1 << endl; cout << "p2 = " << p2 << endl; cout << "p3 = " << p3 << endl; cout << endl; p1.translate(3, 8); cout << "p1 now = " << p1 << endl; cout << endl; cout << "p1 distance from origin = " << p1.distance_from_origin() << endl; cout << "p2 distance from origin = " << p2.distance_from_origin() << endl; cout << "p3 distance from origin = " << p3.distance_from_origin() << endl; cout << endl; vector v; for (int i = 1; i <= 3; i++) { for (int j = 1; j <= 3; j++) { v.push_back(point(i, j)); } } cout << "number of equal points = " << count_equal(v) << endl; return 0; }