I am having trouble on figureing out on how to return more than one value for x and Y. I know you can only have one return statement but i need to return a value for x and y. I am a little lost on how to do this.
This is what i have so far.
Point.cpp
Point Point::midpoint(Point &midPointX, Point &midPointY)
{
Point middle;
midPointX = ((0 + middle.getX()) / 2); // i am adding 0 because its supposed to go from point (0,0)
midPointY = ((0 + middle.getY()) / 2); // i am adding 0 because its supposed to go from point (0,0)
return middle;
}
here is a sample output of the program. If more code is needed i to see if i am going wrong somewhere i can post it but when i comment out the midpoint stuff it compiles fine and just gives (0,0) as the midpoint
Please enter two coordinates
1st coordinate: 2
2nd coordinate: 2
The coordinates are: (2, 2)
The distance from invoking point (0,0)
to the coordinate you entered (2,2)
is: 2.82843 units
The midpoint between the invoking point (0,0)
and the coordinate you entered (2,2)
is: (0,0)