static void Main(string[] args) { ReadOnlyVector vector = new ReadOnlyVector(3, 4); Console.WriteLine($"X = {vector.X}; Y = {vector.Y}"); Console.WriteLine($"Vector = {vector.Add(vector).X}; {vector.Add(vector).Y}"); Console.WriteLine(new string('-', 30)); ReadOnlyVector vector1 = vector.WithX(5); Console.WriteLine($"X = {vector1.X}; Y = {vector1.Y}"); Console.WriteLine($"New vector = {vector.Add(vector1).X}; {vector.Add(vector1).Y}"); Console.WriteLine(new string('-', 30)); }
public static void Main(string[] args) { ReadOnlyVector v1 = new ReadOnlyVector(3.2, 8.5); ReadOnlyVector v2 = new ReadOnlyVector(v1.WithX(10.5).X, 8.5); ReadOnlyVector v3 = new ReadOnlyVector(3.2, v1.WithY(7.3).Y); ReadOnlyVector v4 = v1.Add(v2); ReadOnlyVector v5 = v1.Add(v3); Console.WriteLine("Вектор v1 х={0} y={1}", v1.X, v1.Y); Console.WriteLine("Вектор v2 WithX х={0} y={1}", v2.X, v2.Y); Console.WriteLine("Вектор v3 WithY х={0} y={1}", v3.X, v3.Y); Console.WriteLine("Суммирующий вектор v4 х={0} y={1}", v4.X, v4.Y); Console.WriteLine("Суммирующий вектор v5 х={0} y={1}", v5.X, v5.Y); Console.ReadKey(); }
static void Main(string[] args) { ReadOnlyVector vector = new ReadOnlyVector(5, 8); Console.WriteLine(vector); ReadOnlyVector vector2 = new ReadOnlyVector(8, 9); Console.WriteLine(vector2); ReadOnlyVector vector3 = vector.Add(vector2); Console.WriteLine(vector3); ReadOnlyVector vector4 = vector3.WithX(0.55); Console.WriteLine(vector4); ReadOnlyVector vector5 = vector3.WithY(0.56); Console.WriteLine(vector5); }