Example #1
0
        static void Main(string[] args)
        {
            int opcion = 0;

            double[,] ma1 = new double[0, 0];
            double[,] ma2 = new double[0, 0];
            try
            {
                Console.Write("Escribe el tamaño de las matrices: ");
                // Se lee el tamaño de las matrices
                int tam = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Valores de la Matriz 1");
                // Solicitamos los varlores para llenar la matriz
                ma1 = new double[tam, tam];
                // Se almacenan los valores de la matriz
                MatrizN.Valores(ref ma1);
                Console.WriteLine("Valores de la Matriz 2");
                ma2 = new double[tam, tam];
                MatrizN.Valores(ref ma2);
                // Se lee el valor del menu
                opcion = MatrizN.Menu();
                //Se muestran los valores de las matrices
                Console.WriteLine("Matriz 1:");
                MatrizN.Imprimir(ref ma1);
                Console.WriteLine("Matriz 2:");
                MatrizN.Imprimir(ref ma2);
                Console.WriteLine("\n");
            }
            catch (FormatException) {
                Console.WriteLine("ERROR");
            }
            //Se evalua la opcion
            switch (opcion)
            {
            case 0:
                Console.WriteLine("Opcion Invalida");
                break;

            case 1:
                //Se usa le metodo suma
                MatrizN.Suma(ref ma1, ref ma2);
                break;

            case 2:
                //Se usa le metodo resta
                MatrizN.Resta(ref ma1, ref ma2);
                break;

            case 3:
                //Se usa le metodo multiplicacion
                MatrizN.MultiplicaMatrices(ref ma1, ref ma2);
                break;
            }
            Console.ReadKey();
        }