In mathematics, the distance between one point (A) and another point (B), each with coordinates (x,y), can be computed by taking the differences of their x coordinates and their y coordinates and then squaring those differences. The squares are added and the square root of the resulting sum is taken and… voila! The distance. Assume that Point has already been defined as a structured type with two double fields, x and y. Define a function dist that takes two Point arguments and returns the distance between the points they represent.

In mathematics, the distance between one point (A) and another point (B), each with coordinates (x,y), can be computed by taking the differences of their x coordinates and their y coordinates and then squaring those differences. The squares are added and the square root of the resulting sum is taken and… voila! The distance. Assume that Point has already been defined as a structured type with two double  fields, x and y. Define a function dist that takes two Point arguments and returns the distance between the points they represent.

LANGUAGE: C++

CHALLENGE:

In mathematics, the distance between one point (A) and another point (B), each with coordinates (x,y), can be computed by taking the differences of their x coordinates and their y coordinates and then squaring those differences. The squares are added and the square root of the resulting sum is taken and… voila! The distance. Assume that Point has already been defined as a structured type with two double fields, x and y. Define a function dist that takes two Point arguments and returns the distance between the points they represent.

This content requires that you purchase additional access. The price is $2.99 or free for our Make Life Easier and 30 Days – Not Recurring members.

Purchase this Content ($2.99) Choose a Membership Level