Question: Exercise 5 . 5 The distance between two points ( x 1 , y 1 ) and ( x 2 , y 2 ) is
Exercise The distance between two points x y and x y is
Distance
p
x x
y y
Please write a function named distance that takes four doubles as parametersx
y x and yand that prints the distance between the points.
You should first write a function called sumSquares that calculates and returns the
sum of the squares of its arguments. For example:double x sumSquares ;
would assign the value to x
The point of this exercise is to write a new function that uses an existing one. You
should first write the sumSquares function then use that function in your distance
function. Write a main function that tests each function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
