#include <iostream>
#include <cmath>
using namespace std;
class Point {
private:
double x, y;
public:
Point(double xVal, double yVal) {
x = xVal;
y = yVal;
}
double distanceTo(Point other) {
return sqrt(pow(x - other.x, 2) + pow(y - other.y, 2));
}
};
int main() {
Point p1(1, 2);
Point p2(4, 6);
cout << p1.distanceTo(p2) << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: