Question: C++ Question: Create an overloaded function that computes the distance between 2, 3, 4 or 5 points class XYPoint { public: int x; int y;
C++ 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, int yc) : x(xc), y(yc) {}
};
float distance(XYPoint p1, XYPoint p2);
...
float distance(XYPoint p1, ...XYPoint p5);
distance is computed as two-d distance between points and added : distance{p1-p2} + distance{p2-p3} + distance{p3-p4}
IMPORTANT: you are only to "create the overloaded function(s)" as stated in the first line of this assignment, DO NOT add any main(), we will use your function from our own main and test it from there. If you add a main and the program does not compile when we try to test you will receive zero credit.
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 on Ubuntu. Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
