### find the determinant of a matrix

I use Laplas to find the determinant, but the result is always 0.
my code:
 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 #include #define N 100 int P[N][N]; using namespace std; void determinant(int M[][N]) { int n; int det; int A[N]; int B[N]; memset(A,0,sizeof(A)); memset(B,0,sizeof(B)); static int t=0; static int f=0; static int LHS=0; static int RHS=0; cout<<"please input the rows of the elements"<>n; for(int a=0;a>M[i][j]; for(int i=0;i=0;i--) { do{ int y=P[i][f++]; B[i]*=M[f++][y]; } while(f
_ Modularize
_ Duck debug (especially lines 12,13,37,49,55,58)
_ Don't "optimize"
Can someone give some correction?

int A[N];
int B[N];
memset(A,0,sizeof(A));
memset(B,0,sizeof(B));

you could write

int A[N] = {};
int B[N] = {};

:)
I corrected so, but it still have bug
Sorry but i do not understand what your function does and have no any desire to investigate such a bad code.

Good luck!
Last edited on
Topic archived. No new replies allowed.