#include #include //for the functions sqrt, atan2, and abs #include "point.h" using namespace std; point::point(double initial_x, double initial_y) : x {initial_x}, y {initial_y} { } point::point() : x {0}, y {0} { } double point::r() const //distance to origin { return sqrt(x * x + y * y); } double point::theta() const { return atan2(y, x); //two-argument arctangent } void point::print() const { cout << "(" << x << ", " << y << ")"; } double distance(const point& A, const point& B) { const double dx {A.x - B.x}; const double dy {A.y - B.y}; return sqrt(dx * dx + dy * dy); } double area(const point& A, const point& B, const point& C) { return abs(A.x * (B.y - C.y) + B.x * (C.y - A.y) + C.x * (A.y - B.y)) / 2.0; }