Problem Description
定义点类Point,其中有数据成员x和y,表示点的横坐标与纵坐标。
成员函数double distance(const Point &)的功能是求两点之间的距离。
成员函数void inputPoint()的功能是从键盘输入点的x、y坐标值。
//你的代码将被嵌在这里
int main()
{
Point a, b;
a.inputPoint();
b.inputPoint();
cout << a.distance(b);
return 0;
}
Sample Input
0 0
3 4
Sample Output
5
#include <iostream>
using namespace std;
#include <cmath>
class Point
{
public:
double x, y;
/*Point(int a, int b)
{
x = a;
y = b;
}*/
void inputPoint()
{
cin >> x >> y;
}
double distance(