Question: Create an overloaded function that computes the distance between 2, 3, 4 or 5 points class XYPoint { public: int x; int y; XYPoint(int xc,
Create an overloaded function that computes the distance between 2, 3, 4 or 5 points
class XYPoint {
public:
int x;
int y;
XYPoint(int xc, int yc) : x(xc), y(yc) {}
};
float distance(XYPoint p1, XYPoint p2);
...
float distance(XYPoint p1, ...XYPoint p5);
distance is computes as two-d distance between points and added : distance{p1-p2} + distance{p2-p3} + distance{p3-p4}
This program is to be written in c++ using different a file for header, a file for implementation and other file for main.
Should be compiled in g++ in terminal in an ubuntu system
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
