Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How do I write this function? I cant seem to get it right! #include #include #include using namespace std; struct Point { double x; double
How do I write this function? I cant seem to get it right!
#include
#include
#include
using namespace std;
struct Point {
double x;
double y;
};
//Do not modify anything on or above the line below this
//YOUR_CODE_BELOW
Point midPoint(const Point& a, const Point& b)
{
//IN HERE
}
//YOUR_CODE_ABOVE
//Do not modify anything on or below the line above this
int main()
{
Point p1;
cin >> p1.x;
cin >> p1.y;
Point p2;
cin >> p2.x;
cin >> p2.y;
Point p3 = midPoint(p1, p2);
cout << "(" << p3.x << ", " << p3.y << ")" << endl;
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started