点点决定设计一个点类Point,它具有两个double型的数据成员x、y。
那么接下来点点需要你的帮助,任务如下:
为该类设计构造函数。并为其加入一个友元函数用于计算并输出两点间的距离;
再加入一个输出成员函数用于输出点的信息。
输入格式:
4个数,中间用一个空格间隔。
输出格式:
输出数据共3行。前两行用于显示要求距离的两个点的信息,第三行显示两点的距离。
输入样例:
在这里给出一组输入。例如:
5 6 2 3
输出样例:
在这里给出相应的输出。例如:
The first point is the coordinate:X=5,Y=6
The second point is the coordinate:X=2,Y=3
The distance between the two points is:4.24264
#include<bits/stdc++.h>
using namespace std;
class Point{
protected:
double x;
double y;
public