n阶方阵求逆c语言报告,n阶方阵求逆

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

{

j ++;

if (j == n) break;

}

if (j == n) break;

gauss (matrix, matrix, k, j, n);

}

}

for (i = 0; i <= n - 1; i ++)

{

temp = resault;

*resault = *temp * matrix[i][i];

}

}

void main( )        //矩阵求逆

{

double **matrix, **M, resault = 1,**adjoint, **inverse, **answer;

int n, i, j, k;

printf("请输入矩阵的阶数:");

scanf("%d", &n);

matrix = (double **)malloc(n * sizeof(double *));

adjoint = (double **)malloc(n * sizeof(double *));

inverse = (double **)malloc(n * sizeof(double *));

answer = (double **)malloc(n * sizeof(double *));

M = (double **)malloc(n * sizeof(double *));

for (i = 0; i < n; i ++)

{

matrix[i] = (double *)malloc(n * sizeof(double));

adjoint[i] = (double *)malloc(n * sizeof(double));

inverse[i] = (double *)malloc(n * sizeof(double));

answer[i] = (double *)malloc(n * sizeof(double));

M[i] = (double *)malloc(n * sizeof(double));

}

printf("请输入矩阵:\n(每个数据用空格隔开,一行输入结束后按回车)\n");

for (i = 0; i <= n - 1; i ++)

{

for (j = 0; j <= n - 1; j ++)

{

scanf("%lf", &matrix[i][j]);

M[i][j] = matrix[i][j];

}

}

for (i = 0; i <= n - 1; i ++)

{

for (j = 0; j <= n - 1; j ++)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值