#include <iostream>
using namespace std;
// Define new type "point"
struct point
{
double x, y;
};
point midpoint(point a, point b);
int main()
{
// Creates objects P & Q of type point
point P,Q;
// Reads & stores points
cout << "Enter two points (x,y): ";
char c;
cin >> c >> P.x >> c >> P.y >> c;
cin >> c >> Q.x >> c >> Q.y >> c;
// Computes and writes midpoint
point M = midpoint(P,Q);
cout << "Midpoint is (" << M.x
<< ',' << M.y << ")" << endl;
return 0;
}
// midpoint(a,b) returns the midpoint of a and b
point midpoint(point a, point b)
{
point m;
m.x = (a.x + b.x)/2;
m.y = (a.y + b.y)/2;
return m;
}