请帮忙再看一下这个程序如何简化!
StarWing83 说的非常好!
您的上个程序我已经理解了,能在把以下这个程序便一下吗?
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 18
//计算原矩阵的行列式 |A|
double nm(double s[N][N],double n)
{
int z,j,k;
double r;
double total=0;
double b[N][N];
if(n>2)
{
for(z=0;z<n;z++)
{
for(j=0;j<n-1;j++)
for(k=0;k<n-1;k++)
if(k>=z) b[j][k]=s[j+1][k+1];
else b[j][k]=s[j+1][k];
if(z%2==0) r=s[0][z]*nm(b,n-1);
else r=(-1)*s[0][z]*nm(b,n-1);
total=total+r;
}
}
else if(n==2) total=s[0][0]*s[1][1]-s[0][1]*s[1][0];
return total;
}
void main()
{
double r;
int z,j;
double A[N][N]={216.080575,64.334189,81.390948,18.961460,68.975034,27.294921,51.867969,45.292775,35.914893,7.521622,281.840523,85.170013,113.368330,43.404363,};
r=nm(A,N);
printf("\nThe is:r== %f \n",r);
}