/* Lab1, Classes and Objects; Member functions and Non-member functions < expected output > Enter x and y for a point: 1 2 Enter x and y for a point: 2 3 The shortest distance (using mf) = 1.41421 The shortest distance (using non-mf) = 1.41421 The middle point (using mf) = x = 1.5, y = 2.5 The middle point (using non-mf) = x = 1.5, y = 2.5 */ #include #include class Point { private: double x; double y; public: Point() { cout << "Enter x and y for a point: "; cin >> x >> y; } Point(double xinput, double yinput) { x = xinput; y = yinput; } double getx() { return x; } double gety() { return y; } void displayPoint() { cout << "x = " << x << ", "; cout << "y = " << y << endl; } double dist(Point p) { } Point middle(Point p) { } }; double dist2(Point p1, Point p2) // another way of finding shortest dist // Note: this is a non-member function { } Point middle2(Point p1, Point p2) // Note: this is a non-member function { } void main() { Point p1, p2; cout << "The shortest distance (using mf) = " << p1.dist(p2) << endl; cout << "The shortest distance (using non-mf) = " << dist2(p1,p2) << endl; cout << "The middle point (using mf) = "; p1.middle(p2).displayPoint(); cout << "The middle point (using non-mf) = "; middle2(p1, p2).displayPoint(); }