logo CodeStepByStep logo

computeDistance

Language/Type: C++ parameters Math

Write a function named computeDistance that accepts four integer coordinates x1, y1, x2, and y2 as parameters and computes the distance between points (x1, y1) and (x2, y2) on the Cartesian plane. The formula for the distance between two points is:

distance equation

For example, the call of computeDistance(10, 2, 3, 5) would return 7.615773105863909.

Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.