Question: Please use C + + , 3 Struct Data Types Use program Distance for Exercise 3 . / / Program Distance gets user inputs for
Please use C
Struct Data Types
Use program Distance for Exercise
Program Distance gets user inputs for the x y coordinates
of two points, then calculates the distance between the two
points and prints the result.
#include
#include
using namespace std;
struct Point
double x;
double y;
;
void printPoint Point p
cout.precision;
cout fixed showpoint;
cout px py ;
return;
Point readPoint
Point p;
cout "Enter point x y: ;
cin px py;
return p;
int main
Point p p;
p readPoint;
p readPoint;
cout "The distance between ;
printPointp;
cout and ;
printPointp;
cout is PointDistancepp endl;
return ;
Exercise :
Create a function called PointDistance that calculates distance between the two points. It should be a
double valuereturning function that accepts two parameters both of type Point. Dont forget to use the
sqrt function.
Run the program and enter the results for the following data. In your lab report, also include the
modified cpp file.
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
