static void Main(string[] args) { int x = 800; int y = 600; MyVector mv = new MyVector(x, y); Console.WriteLine(mv[0]); Console.WriteLine(mv[1]); Console.WriteLine(mv["y"]); Console.WriteLine(mv["a"]); Console.WriteLine(mv["B"]); }
static void Main(string[] args) { // Instancia de MyVector que aceita dois parametros MyVector v = new MyVector(3, 5.5f); // Indixando valores ao index do nosso index da struct // myStruct v[1] = 3.4f; v[0] = -266; //Escrever resultados na consola Console.WriteLine($"{v[0]} ou {v.Y}"); }
static void Main(string[] args) { MyVector v = new MyVector(6, 10); Console.WriteLine($"{v[0]} {v[0]} {v.X}"); Console.WriteLine($"{v[1]} {v[1]} {v.Y}"); MyVector v2 = new MyVector(-1, -5); MyVector v3 = v + v2; Console.WriteLine(v3[0]); Console.WriteLine(v3[1]); }
static void Main(string[] args) { MyVector v1 = new MyVector(3, 5); MyVector v2 = new MyVector(70, 5); Console.WriteLine($"vector 1 = {v1.X}; vector 2 = {v2.Y}"); v1[0] = 90; v2[1] = 30; Console.WriteLine($"vector 1 = {v1.X}; vector 2 = {v2.Y}"); v1["a"] = 1; v2["y"] = 1000; Console.WriteLine($"vector 1 = {v1.X}; vector 2 = {v2.Y}"); }
static void Main(string[] args) { MyVector vetor = new MyVector(1, 0); Console.WriteLine(vetor.X); Console.WriteLine(vetor.Y); vetor[0] = 2; vetor[1] = 2; Console.WriteLine(vetor.X); Console.WriteLine(vetor.Y); vetor["a"] = 3; vetor["y"] = 3; Console.WriteLine(vetor.X); Console.WriteLine(vetor.Y); }
static void Main(string[] args) { MyVector vec1 = new MyVector(1.5f, 3.7f); MyVector vec2 = new MyVector(7.6f, 9.1f); Console.WriteLine($"vector 1 X: {vec1[0]}/{vec1.X}" + $"\nvector 1 Y: {vec1[1]}/{vec1.Y}" + $"\nvector 2 X: {vec2[0]}/{vec2.X}" + $"\nvector 2 Y: {vec2[1]}/{vec2.Y}"); vec1[0] = 666.666f; Console.WriteLine(vec1[0]); vec1["x"] = 27.5f; vec1["b"] = 50.5f; vec2["a"] = 60.5f; vec2["1"] = 50.5f; Console.WriteLine($"vector 1 X: {vec1["x"]}/{vec1["a"]}" + $"vector 1 Y: {vec1["y"]}/{vec1["b"]}" + $"vector 2 X: {vec2["a"]}/{vec2["0"]}" + $"vector 2 Y: {vec2["b"]}/{vec2["1"]}"); }