Question: Code in Visual Studio C++/ Use intermediate/beginner code The distance between two points can be calculated using the following expression: Distance (X2-XI) (Y2-YI) In this

Code in Visual Studio C++/ Use intermediate/beginner code

Code in Visual Studio C++/ Use intermediate/beginner code The distance between two

The distance between two points can be calculated using the following expression: Distance (X2-XI) (Y2-YI) In this expression X1 and Y1 represent the coordinates of one point and X2 and Y2 represent the coordinate of the other point An input file (called value. txt ) containing eight sets of points is provided as listed below. Write a program to calculate the distance between each set of points of this input file using the following restrictions: 1. The program should represent each point by a structure called point, having two members (Xand Y). 2. The program should use a function to calculate the distance between each pair of points. The inputs to the function are two variables of type point and the output is the distance; name this function dist 3. The program should read the coordinates of points from the input file and write the distance with the corresponding coordinates of the points to an output file similar to the one shown with proper heading). Input (Value. dat) file Output file X2X2 Distance 0.0 0.0 2.0 1.8 1.0 3.0 2.8 3.5 2.2 4.4 1.1 6.8 -8.0 6.0 7.0 7.2 5.4 2.4 -9.0 -4.6 .0 4.0 2.0 3.0 2.3 3.4 4.4 5.5 7.3 7.3 9.3 9.3 0.0 0.0 2.0 1.8 2.2 4.4 1.1 6.8 -8.0 -6.0 7.0 7.2 5.4 2.4 -9.0 -4.6 .0 4.0 2.0 3.0 2.3 3.4 4.4 5.5 7.3 7.3 9.3 9.3

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!