Description
Design a C++ class named Point that represents a point in the plan. This class has the following private member variables.
x, y that are real numbers representing the coordinates of the point in the plane.
In addition, the class should have the following constructor and functions.
1)A constructor that initializes the (x, y) coordinates using two parameters;
2)A member function that computes the distance between two points where one point is the calling object and the other point is given as a parameter of the function;
3)A member function that overloads the + operator for adding two points where one point is the calling object and the other point is given as a parameter of the function;
4)A friend function that overloads the << operator for printing points.
Design a main function to test the Point class as follows.
1)Create a first point using the coordinate entered by user through keyboard, and output it using the operator <<;
2)Create a second point with coordinate (1, 2), and output it too;
3)Compute and print the distance between the two points in a separate line ;
4)Add the first point and the second point, and print the resulting point.
Input
The x and y value of the first point
Output
The x and y value of the first point
The x and y value of the second point
The distance between the points
The resulting point by adding the two points