calculating distance from one point too another C++
So i have my double that calculates the distance
double calculate2DDistance(int x1, int y1, int x2, int y2)
{
return sqrt((x2 - x1)^2 + (y2 - y1)^2);
}
Note i'm calling this method from a header called math.h into my main
My testing line in main.h
cout << calculate2DDistance(2.0, 4.0, 3.0, 1.0) << endl;
and it either prints out the completely wrong answer or -1.#IND
Whats going on ?
No comments:
Post a Comment