Kat H.

Midpoint Finder. Write a function: void findMidpoint(double x1, double y1, double x2, double y2, double& xMid, double& yMid)

Write a function:

void findMidpoint(double x1, double y1, double x2, double y2, double& xMid, double& yMid)

Assume x1, y1 and x2, y2 represent two coordinates on a Cartesian plane. Calculate the location of the midPoint and return it via the reference parameters xMid and yMid.The midpoint of x1, y1 and x2, y2 is at (x1 + x2)/2, (y1 + y2)/2

Code:

#include <iostream>

using namespace std;

//Do not modify anything on or above the line below this

//YOUR_CODE_BELOW

//YOUR_FUNCTION HERE

//YOUR_CODE_ABOVE

//Do not modify anything on or below the line above this

int main()

{

double in1, in2, in3, in4;

cin >> in1 >> in2 >> in3 >> in4;

double m1 = 0, m2 = 0;

findMidpoint(in1, in2, in3, in4, m1, m2);

//If m1 and m2 are both still 0, your function did not modify them

cout << m1 << "," << m2 << endl;

}

By:

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.