Question: Complete the Code: #include #include using namespace std; struct point { int x, y; }; void setX(point & p, double xV); void setY(point & p,

Complete the Code:

#include

#include

using namespace std;

struct point {

int x, y;

};

void setX(point & p, double xV);

void setY(point & p, double yV);

double getX(const point & p);

double getY(const point & p);

void print(ostream & w, const point & p);

point makePoint(double xV, double yV);

point * makePointPtr(double xV, double yV);

void makePoint(double xV, double yV, point & result);

void makePoint(double xV, double yV, point * ptrAns);

void input(point & p);

double Distance(const point & p1, const point & p2);

void main() {

point P1, P2;

// test setX and setY for P1 and P2

// for P1 and P2, print out the x and y value for each one of them using the getX and getY methods

// print out the x and y value for P1 or P2 using print method

point Pa;

// assign x and y values of Pa using the first makePoint method

point * Pb;

// assign x and y values of Pb using the makePointPtr method

point Pc;

// assign x and y values of Pc using the second makePoint method, notice that Pc is passed as ref

point Pd;

// assign x and y values of Pd using the third makePoint method, notice that Pd is passed as pointer

point P3;

// assign P3 x and y values using the input method

// create a double data type variable and assign the value returned from the distance method to it using P1 and P2

system("pause");

}

void setX(point & p, double xV) {

}

void setY(point & p, double yV) {

}

double getX(const point & p) {

}

double getY(const point & p) {

}

void print(ostream & w, const point & p) {

}

point makePoint(double xV, double yV) {

}

point * makePointPtr(double xV, double yV) {

}

void makePoint(double xV, double yV, point & result) {

}

void makePoint(double xV, double yV, point * ptrAns) {

}

void input(point & p) {

}

double Distance(const point & p1, const point & p2) {

double dis;

dis = sqrt(pow((p1.x - p2.x), 2) + pow((p1.y - p2.y), 2));

return dis;

}

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!