Daianne 0 Denunciar post Postado Agosto 19, 2009 Olá pessoal, alguém poderia me mostrar um exemplo de um programinha que leia uma matriz de valores reais tamanho 3X3, calculando seu determinante? Compartilhar este post Link para o post Compartilhar em outros sites
Giovanni Ritchie 0 Denunciar post Postado Agosto 20, 2009 Ja tentou alguma coisa?? Compartilhar este post Link para o post Compartilhar em outros sites
Daianne 0 Denunciar post Postado Agosto 20, 2009 public int DetMatriz(int mat[][], int ord) { if (ord == 1) return (mat[0][0]); if (ord == 2) return ( mat[0][0] * mat[1][1] - mat[1][0] * mat[0][1] ); else { int[][] matAux = new int[ord - 1][ord - 1]; int colAux = 0; for (int controle = 0; controle < ord; controle++) { for (int linha = 1; linha < ord; linha++) { for (int coluna = 0; coluna < ord; coluna++) if (controle != coluna) matAux[linha - 1][colAux++] = mat[linha][coluna]; colAux = 0; } if (mat[0][controle] != 0) this.DET += (int) Math.pow((-1), controle) * mat[0][controle] * DetMatriz(matAux, ord - 1); } } return (this.DET); } Compartilhar este post Link para o post Compartilhar em outros sites
Kandrade 7 Denunciar post Postado Agosto 22, 2009 O código está funcionando do jeito que voce quer? Compartilhar este post Link para o post Compartilhar em outros sites
Daianne 0 Denunciar post Postado Agosto 24, 2009 Não Compartilhar este post Link para o post Compartilhar em outros sites