How can I fix this?

There is an error in my code, this is what it looks like (just the part where the error is). How can I fix it?

 
  d=sqrt((x2-x1)^2+(y2-y1)^2);
What is the error?" Do you think we are mind readers?

What are the types of d, x1, x2, y1, y2?

^2 is not an exponentiation operator. ^ is the bitwise XOR operator.

You are taking the square root correctly but your not squareing your numbers correctly you need to us pow. So (x2-x1)^2 should look like pow((x2-x1),2)

http://www.cplusplus.com/reference/cmath/pow/
Thanks a lot guys.
Topic archived. No new replies allowed.