Question: In C++, Write a function to calculate the distance between two points: Distance( x1, y1, x2, y2 ) For example: Distance(0.0, 3.0, 4.0, 0.0) should

In C++, Write a function to calculate the distance between two points:

Distance( x1, y1, x2, y2 )

For example:

Distance(0.0, 3.0, 4.0, 0.0) should return 5.0

Use the function in main to loop through reading in pairs of points until the all zeros are entered, printing distance with two decimal precision for each pair of points.

For example with input:

32 32 54 12 52 56 8 30 44 94 44 39 65 19 51 91 1 5 89 34 0 0 0 0

your output would be:

29.73 51.11 55.00 73.35 92.66

Example:

#include #include //cmath header file is used. #include #include using namespace std;

// function will come here.

int main(){

Please only use coding in C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!