猴子写的代码
  • 板块灌水区
  • 楼主嘉年华
  • 当前回复6
  • 已保存回复6
  • 发布时间2021/10/11 11:08
  • 上次更新2023/11/4 04:05:34
查看原帖
猴子写的代码
85994
嘉年华楼主2021/10/11 11:08
#include<bits/stdc++.h>
using namespace std;
#define maxn 1005
class mar
{
	public:
		int n;
		int v[maxn][maxn];
		mar() {memset(v,0,sizeof(v));}
		friend mar operator * (const mar &a,const mar &b)
		{
			mar c;
			c.n=a.n;
			for(int i=1;i<=c.n;++i)
				for(int j=1;j<=c.n;++j)
				{
					c.v[i][j]=0;
					for(int k=1;k<=c.n;++k)
						c.v[i][j]=c.v[i][j]+a.v[i][k]*b.v[k][j];
				}
			return c;
		}
		inline void input()
		{
			n=1;
			for(int i=1;i<=n;++i)
				for(int j=1;j<=n;++j)
					v[i][j]=rand()-1023;
		}
};//矩阵 
mar a,b,c;
signed main()
{
	srand(time(0));
	a.input();
	b.input();
	cout<<1<<endl;
	
	c=a*b;/////////////////
	//矩阵乘法 
	
	cout<<clock();
	return 0;
}

上面代码一执行,会显示停止执行,返回3221335725,如果调试会弹出cpu窗口
如果注释掉第40行,则可以正常运行
然而,在取消注释后38行的过程输出也不会执行了
求解

2021/10/11 11:08
加载中...