#include #include #include using namespace std; struct Point { long double x, y; Point(): x(0), y(0) {} Point(long double x0, long double y0): x(x0), y(y0) {} long double dist(const Point & other) { return hypotl(other.x - x, other.y - y); } }; struct Vector { long double x, y; Vector(): x(0), y(0) {} Vector(long double x0, long double y0): x(x0), y(y0) {} Vector(const Point & A, const Point & B) { x = B.x - A.x; y = B.y - A.y; } long double dist() { return hypotl(x, y); } // Пример перегрузки оператора, как метода класса long double operator % (const Vector & other) const { return x * other.y - y * other.x; } Vector operator * (double k) const { return Vector(k * x, k * y); } }; // Пример перегрузки оператора, как отдельной функции long double operator * (const Vector & a, const Vector & b) { return a.x * b.x + a.y * b.y; } Vector operator + (const Vector & a, const Vector & b) { return Vector(a.x + b.x, a.y + b.y); } // Переопределение вывода ostream & operator << (ostream & out, const Vector & a) { out << a.x << " " << a.y; return out; } // Переопределение ввода istream & operator >> (istream & in, Vector & a) { in >> a.x >> a.y; return in; } istream & operator >> (istream & in, Point & a) { in >> a.x >> a.y; return in; } int main() { Point P, A, B; ofstream fout("output.txt"); cin >> P >> A >> B; Vector AB(A, B); Vector AP(A, P); if (AB % AP == 0 && AB * AP >= 0) cout << "YES" << endl; else cout << "NO" << endl; fout << AB << endl; fout.close(); return 0; }