Problem Description
设计一个点(Point)类,用x、y表示点的坐标值。
用全局函数double dist(Point , Point)计算两坐标点间的距离。
//你的代码将被嵌在这里
int main() {
Point p1(3, 0), p2(0, 4);
cout << dist(p1, p2) << endl;
return 0;
}
Sample Input
无
Sample Output
5
#include <iostream>
using namespace std;
#include <cmath>
class Point
{
public:
double x, y;
Point(double a, double b)
{
x = a;
y = b;
}
};