Last active
August 3, 2019 20:38
-
-
Save heronyang/5bb91ad5c3d78709ebed648afeb14419 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* point.cc */ | |
#include "point.h" | |
#include <math.h> | |
Point::Point(double x, double y): x(x), y(y) {} | |
double Point::getDistance(const Point& p) const { | |
double dx = x - p.x; | |
double dy = y - p.y; | |
return sqrt(dx*dx + dy*dy); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment