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 );
}
}
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 override string ToString()
{
return $"vecrot x={x},y={y}";
}
}
internal class Program
{
static void Main(string[] args)
{
Point p1 = new Point(2, 3);
Point p2 = new Point(3, 1);
Vector v1 = new Vector(p1, p2);
Vector v2 = new Vector{x = 2, y = 3};
WriteLine(v1 + v2);
WriteLine(v1 - v2);
WriteLine(v1 * 5);
}
}
}