using System.Runtime.CompilerServices;
using static System.Console;
namespace ConsoleApp19
{
class Point
{
public int x { get; set; }
public int y { get; set; }
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
public static Point operator --(Point p)
{
p.x--;
p.y--;
return p;
}
public static Point operator ++(Point p)
{
p.x++;
p.y++;
return p;
}
public static Point operator -(Point p)
{
return new Point(-p.x, -p.y);
}
public override bool Equals(object? obj)
{
return this.ToString() == obj.ToString();
}
public override int GetHashCode()
{
return this.ToString().GetHashCode();
}
public static bool operator ==(Point p1, Point p2)
{
return p1.Equals(p2);
}
public static bool operator !=(Point p1, Point p2)
{
return !(p1 == p2);
}
public static bool operator >(Point p1, Point p2)
{
return Math.Sqrt(p1.x ^ 2 + p1.y ^ 2) > Math.Sqrt(p2.x ^ 2 + p2.y ^ 2);
}
public static bool operator <(Point p1, Point p2)
{
return Math.Sqrt(p1.x ^ 2 + p1.y ^ 2) < Math.Sqrt(p2.x ^ 2 + p2.y ^ 2);
}
public static bool operator true(Point p)
{
return p.x != 0 || p.y != 0 ? true : false;
}
public static bool operator false(Point p)
{
return p.x == 0 && p.y == 0 ? true : false;
}
}
class Vector
{
public int x { get; set; }
public int y { get; set; }
public Vector() { }
public Vector(Point begin,Point end)
{
x = end.x - begin.x;
y = end.y - begin.y;
}
public static Vector operator +(Vector v1, Vector v2)
{
return new Vector { x = v1.x + v2.x, y = v1.y + v2.y };
}
public static Vector operator -(Vector v1, Vector v2)
{
return new Vector { x = v1.x - v2.x, y = v1.y - v2.y };
}
public static Vector operator *(Vector v1,int n)
{
v1.x = v1.x * n;
v1.y = v1.y * n;
return v1;
}
public static Vector operator *(int n,Vector v1)
{
v1.x = v1.x * n;
v1.y = v1.y * n;
return v1;
}
public override string ToString()
{
return $"vector x={x},y={y}";
}
}
internal class Program
{
static void Main(string[] args)
{
Point p1 = new Point(2, 3);
Point p2 = new Point(2, 3);
//Vector v1 = new Vector(p1, p2);
//Vector v2 = new Vector{x = 2, y = 3};
//WriteLine(v1 + v2);
//WriteLine(v1 += v2);
//WriteLine(v1 - v2);
//WriteLine(v1 -= v2);
//WriteLine(v1 * 5);
//WriteLine(5*v1);
//WriteLine(p1 == p2);
if (p1)
{
WriteLine("Не в начале координат");
}
else
{
WriteLine("В начале координат");
}
}
}
}