static void Main(string[] args) { Matr x = new Matr(); x.Generator(2, 2); x.Save("Matrix1.txt"); Matr y = new Matr(); y.Generator(2, 2); y.Save("Matrix2.txt"); Console.WriteLine("Матрица 1"); if (x.LoadMatrix("Matrix1.txt")) { x.PrintMatrix(); } Console.WriteLine(); Console.WriteLine("Матрица 2"); if (y.LoadMatrix("Matrix2.txt")) { y.PrintMatrix(); } Console.WriteLine(); Console.WriteLine("Сумма"); if (x.LoadMatrix("Matrix1.txt") && y.LoadMatrix("Matrix2.txt")) { Console.WriteLine(x.SummaElementov() - y.SummaElementov()); } }
static void Main(string[] args) { try { int[,] myArray1 = Input.Input1(); Console.WriteLine("Исходный массив 1 >>"); Matr.Print(myArray1); Console.WriteLine(); int[,] myArray2 = Input.Input2(); Console.WriteLine("Исходный массив 2 >>"); Matr.Print(myArray2); Console.WriteLine(); Console.WriteLine("Разность сумм двух матриц >> "); Console.WriteLine($"{Matr.SummaElement(myArray1)} - {Matr.SummaElement(myArray2)} = " + (Matr.SummaElement(myArray1) - Matr.SummaElement(myArray2))); } catch (Exception ex) { Console.WriteLine(ex); } }