After build this code, I get this error: Process terminated with status -1073741571 (0 minute(s), 0 second(s)). So what should I do to solve this problem?
I'm using Code::Blocks 16.01. I tried many times but always got this error. But if this code is ran on Ideone, it is okay.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
struct matrix
{
ll val[3005][3005];
ll row, col;
};
matrix operator * (matrix a, matrix b)
{
matrix res;
if(a.col != b.row)
return res;
for(ll i = 1; i <= a.row; i++)
for(ll j = 1; j <= b.col; j++)
for(ll k = 1; k <= a.col; k++)
res.val[i][j] = res.val[i][j] + a.val[i][k] * b.val[k]
[j];
res.row = a.row; res.col = b.col;
return res;
}
matrix a,b,c;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>a.row>>a.col>>b.row>>b.col;
for(ll i = 1; i <= a.row; i++)
for(ll j = 1; j <= a.col; j++)
cin>>a.val[i][j];
for(ll i = 1; i <= b.row; i++)
for(ll j = 1; j <= b.col; j++)
cin>>b.val[i][j];
c = a * b;
for(ll i = 1; i <= c.row; i++)
{
for(ll j = 1; j <= c.col; j++)
cout<<c.val[i][j]<<" ";
cout<<endl;
}
return 0;
}
Thank you very much for helping!
Aucun commentaire:
Enregistrer un commentaire