#include //for sqrt #include "point.h" using namespace std; const point point_origin; //give arguments 0.0, 0.0 to constructor //Return the distance between this point and the origin. double point::dist() const { const double dx = point_origin.x - x; const double dy = point_origin.y - y; return sqrt(dx * dx + dy * dy); //Pythagorean theorem } //Return the distance between this point and another. double point::dist(const point& another) const { const double dx = another.x - x; const double dy = another.y - y; return sqrt(dx * dx + dy * dy); } //Return the area of the triangle whose vertices are points *this, B, and C. double point::area(const point& B, const point& C) const { return abs(x * B.y + B.x * C.y + C.x * y - y * B.x - B.y * C.x - C.y * x) / 2; }