#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>
using namespace std;
struct Matrix
{
const static int MAXN = 200;
int data[MAXN][MAXN];
int n, m;
int MOD;
Matrix()
{
n = 3;
m = 3;
MOD = 110100;
}
/*
Matrix(int a, int b, int mod)
{
n = a;
m = b;
MOD = mod;
}
*/
Matrix operator * (const Matrix &t) const
{
Matrix e;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
e.data[i][j] = 0;
for (int k = 0; k < m; k++)
{
e.data[i][j] += (long long)data[i][k] * t.data[k][j] % MOD;
}
e.data[i][j] %= MOD;
}
}
return e;
}
Matrix setE()
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
data[i][j] = (i == j) ? 1 : 0;
}
}
}
Matrix print()
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
printf(j == m - 1 ? "%d\n" : "%d ", data[i][j]);
}
}
}
Matrix readData()
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
scanf("%d", &data[i][j]);
}
}
}
};
int main()
{
Matrix m;
m.readData();
Matrix n;
n.readData();
m.print();
n.print();
Matrix temp = m * n;
temp.print();
system("pause");
return 0;
}
今天的文章templete_Matrix分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/28101.html