#include <iostream>
using namespace std;
int main()
{
int c_matrix0[3][3] = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
int c_matrix1[3][3] = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
int multi_matrix[3][3] = {};
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
multi_matrix[i][j] += c_matrix0[i][k] * c_matrix1[k][j];
}
}
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cout << multi_matrix[i][j] << " ";
}
cout << endl;
}
}
No comments:
Post a Comment