// implmentation of class point // and overloded operators (as nonmemebrer) // FILL in the missing code #include "point.h" #include "stdinc.h" Point::Point(){ //constructor that takes no arguments x_ = 0; // initializes x-coord and y-coord to 0 y_ = 0; } int Point::x(){ // returns the x-coord return x_; } void Point::x(int xcoord){ //sets the x-coord to the given value x_ = xcoord; } int Point::y(){ //returns the y-coord return y_; } void Point::y(int ycoord){ //sets the y-coord to the given value y_ = ycoord; } float Point::dist(Point p){ // computes Euclidean distance to p float delta_x = (this->x_ - p.x_); //recall "this" is a pointer to float delta_y = (this->y_ - p.y_); // the object from which the return sqrt(delta_x*delta_x + delta_y*delta_y); // "dist" method was used } float Point::dist_origin(){ //computes Euclidean distance to origin /******** COMPLETE THIS ********/ } // Overloading operators as non memebrs // Function to copmare two points p and q // p > q, if distance from p to the origin is greater than the // distance from q to the origin. bool operator> (Point &p, Point &q) { / ***** COMPLETE THIS *****/ } ostream& operator <<( ostream& os, Point& pt ){ //overloads "<<" to output a point os << "(" << pt.x() << "," << pt.y() << ")"; //as (xcoord,ycoord) return os; //returns an output stream, os }