1. the coefficient matrix must be reversible.
2. A is the Augmented Matrix, that is, a [I] [N] is the BI on the right of the I-th equation.
3. After running, a [I] [N] is the value of the nth unknown number.
Typedef double matrix [N] [N]; void gauss_elimination (matrix A, int N) {int I, J, K, R; for (I = 0; I <N; I ++) {// select a row of R and exchange R = I with row I; for (j = I + 1; j <n; j ++) if (FABS (A [J] [I])> FABS (A [r] [I]) r = J; If (R! = I) {for (j = 0; j <= N; j ++) Swap (A [r] [J], a [I] [J]);} // corresponds to the I + 1 ~ For (k = I + 1; k <n; k ++) {double F = A [k] [I]/A [I] [I]; // to make a [k] [I] = 0, for (j = I; j <= N; j ++) multiplied by line I) A [k] [J]-= f * A [I] [J] ;}// return generation for (I = n-1; I> = 0; I --) {for (j = I + 1; j <n; j ++) A [I] [N]-= A [J] [N] * A [I] [J]; A [I] [N]/= A [I] [I];}