Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
using namespace std;

class Point {
public:
    double x, y;
    Point(double x = 0, double y = 0): x(x), y(y) {}
    double norm(){return x*x + y*y;}
};

typedef Point Vector;

double dot(Vector a, Vector b){
    return a.x*b.x + a.y*b.y;
}

struct Segment {
    Point p1, p2;
};

Point project(Segment s, Point p){
    Vector base = s.p2 - s.p1;
    double r = dot(p-s.p1, base) / norm(base);
    return s.p1 + base * r;
}

Point reflect(Segment s, Point p) {
    return p + (project(s,p) - p) * 2.0;
}
int main(){
    double x1,y1,x2,y2,xq,yq;
    char c;
    while(cin>>x1>>c>>y1>>c>>x2>>c>>y2>>c>>xq>>c>>yq){
        Point P1(x1,y1);
        Point P2(x2,y2);
        Point q(xq,yq);
        Segment s;
        s.p1=P1,s.p2=P2;
        Point p=project(s,q);
        cout<<p.x<<" "<<p.y<<endl;
    }
}

Compiler output:
a.cc: In function 'Point project(Segment, Point)':
a.cc:25:24: error: no match for 'operator-' (operand types are 'Point' and 'Point')
   25 |     Vector base = s.p2 - s.p1;
      |                   ~~~~ ^ ~~~~
      |                     |      |
      |                     Point  Point
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:25:28: note:   'Point' is not derived from 'const std::reverse_iterator<_Iterator>'
   25 |     Vector base = s.p2 - s.p1;
      |                            ^~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:25:28: note:   'Point' is not derived from 'const std::move_iterator<_IteratorL>'
   25 |     Vector base = s.p2 - s.p1;
      |                            ^~
a.cc:26:21: error: no match for 'operator-' (operand types are 'Point' and 'Point')
   26 |     double r = dot(p-s.p1, base) / norm(base);
      |                    ~^~~~~
      |                    |   |
      |                    |   Point
      |                    Point
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:26:24: note:   'Point' is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |     double r = dot(p-s.p1, base) / norm(base);
      |                        ^~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:26:24: note:   'Point' is not derived from 'const std::move_iterator<_IteratorL>'
   26 |     double r = dot(p-s.p1, base) / norm(base);
      |                        ^~
a.cc:26:36: error: 'norm' was not declared in this scope
   26 |     double r = dot(p-s.p1, base) / norm(base);
      |                                    ^~~~
a.cc:27:24: error: no match for 'operator*' (operand types are 'Vector' {aka 'Point'} and 'double')
   27 |     return s.p1 + base * r;
      |                   ~~~~ ^ ~
      |                   |      |
      |                   |      double
      |                   Vector {aka Point}
a.cc: In function 'Point reflect(Segment, Point)':
a.cc:31:30: error: no match for 'operator-' (operand types are 'Point' and 'Point')
   31 |     return p + (project(s,p) - p) * 2.0;
      |                 ~~~~~~~~~~~~ ^ ~
      |                        |       |
      |                        Point   Point
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:31:32: note:   'Point' is not derived from 'const std::reverse_iterator<_Iterator>'
   31 |     return p + (project(s,p) - p) * 2.0;
      |                                ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:31:32: note:   'Point' is not derived from 'const std::move_iterator<_IteratorL>'
   31 |     return p + (project(s,p) - p) * 2.0;
      |                                ^