¹ØÓÚÌØÊâÐÐÁеÄÐÐÁÐʽ
ÓÐÏÂÃæµÄÒ»¸öCÓïÑÔµÄÐÐÁÐʽµÄº¯Êý¡££¨×ª×Ôhttp://www.£©µ«ÊÇ£¬Èç¹ûÏñµÚÒ»ÐУ¨0£¬1£©£¬µÚ¶þÐУ¨1£¬0£©ÕâÑùµÄ2³Ë2ÊúÁУ¬Ö÷¶Ô½ÇÏߵĵÚÒ»¸öÐеÚÒ»¸öÔªËØ»¯²»³ÉÒ»¸ö·ÇÁãµÄʵÊýÔõôÐ޸ģ¿
³ýÁËÈ˹¤°ÑÊäÈëµÄÐÐÁеÄÐÐ˳Ðò¸Ä±ä¡£Çó´óʦ...
double matrixdet(Matrix *a)
{
int i,j,k;
double t,det=1,x;
if (a->cols!=a->rows)
{
printf("\n\n\t¤¹¤ß¤Þ¤»¤ó¡¢ÈëÁ¦¤¬Õý·½ÐÐÁФǤϤʤ¤¤Î¤Ç¡¢égß`¤Ã¤Æ¤¤¤Þ¤¹£¡£¡\n");
printf("\tEnter¥©`¤ò´ò¤Ã¤Æ¥×¥í¥°¥é¥à¤ò½KÁˤ·¤Æ¤¯¤À¤µ¤¤¡£\n");
getch();
return -1;
}
else
{
for (i=0;i<a->rows;i++)
for (k=0;k<a->rows;k++)
{
if (k!=i)
{
if (a->m[i][i]!=0)
{
t = a->m[k][i]/a->m[i][i];
for (j=0;j<(2*a->rows);j++)
{
x = a->m[i][j]*t;
a->m[k][j] = a->m[k][j] - x;
}
}
else
return 0;
}
}
for (i=0;i<a->rows;i++)
det = det*a->m[i][i];
return (det);
}
}