一个人的朝圣800
2021-07-09 21:42
采纳率: 75%
浏览 23

C++调试出现奇怪错误?

求逆矩阵
调试出现下面这种提示然后屏幕出现很多奇怪的代码,不知道咋办了,希望各路UU康康,蟹蟹!
'0x007138A9 处有未经处理的异常(在 解方程.EXE 中): 0xC00000FD: Stack overflow (参数: 0x00000000, 0x00E02000)"
如下

#include <cmath>
#include <iomanip>
using namespace std;
//函数声明
int determinant(int A) { return 0; }

int main()
{
    int n;
    float a = 0.0;
    cout << "输入方阵的阶" << endl;
    cin >> n;
    float A[256][256];
    float b[256][256];
    float A_1[256][256];
    int  I[256][256];
//输入方阵
    cout << "按行输入方阵元素" << endl;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            cin >> A[i][j];
    }
//计算行列式
    a = determinant(A[256][256]);
//计算转置
    for (int i = 0; i < n; i++) 
    {
        for (int j = 0; j < n; j++)
            b[i][j] = A[j][i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            A_1[i][j] = b[i][j] / a;
    }
//输出A的逆矩阵
    cout << "A的逆矩阵为:" << endl;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            cout<<A_1[i][j];
        cout << "\n";
    }
//检验
    cout << "AA_1=\n";
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            I[i][j] =(int)A[i][j]*A_1[i][j];
        }
    }
//输出A与A_1的乘积
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
            cout << I[i][j];
        cout << "\n";
    }
    return 0;
}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题