Exemple #1
0
        public override void Calcular(TextBox[,] matriz1, TextBox[,] matriz2)
        {
            base.Calcular(matriz1, matriz2);
            det = M_Determinante2x2.Determinante(matriz1);

            if (det != 0)
            {
                float[,] valor = inversa(matriz1);
                gerador.setMatriz3(0, 0, valor[0, 0].ToString());
                gerador.setMatriz3(1, 0, valor[1, 0].ToString());
                gerador.setMatriz3(0, 1, valor[0, 1].ToString());
                gerador.setMatriz3(1, 1, valor[1, 1].ToString());

                det = 0;
            }
            else
            {
                MessageBox.Show("Essa matriz não tem inverssa");
                det = 0;
            }

            TextBox[,] Resultado = Gerador.getInstance().getMatriz3();
        }
        public override void Calcular(TextBox[,] matriz1, TextBox[,] matriz2)
        {
            base.Calcular(matriz1, matriz2);
            Gerador gerador = Gerador.getInstance();

            if (podeCalcularBool)
            {
                for (int x = 0; x < matriz1.GetLength(0); x++)
                {
                    for (int y = 0; y < matriz1.GetLength(1); y++)
                    {
                        //Pega os dois valores da matriz e soma -Resultado da soma de matrizes na posição-
                        double v1    = Convert.ToInt32(matriz1[x, y].Text);
                        double v2    = Convert.ToInt32(matriz2[x, y].Text);
                        double valor = v1 + v2;

                        //Alterar o texto do Textbox;
                        gerador.setMatriz3(x, y, valor.ToString());
                    }
                }
            }
        }