33矩阵和31矩阵的乘法
#include<iostream>
using namespace std;
void showa(int a[3][3])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
cout << a[i][j] << ",";
}
cout << endl;
}
cout << "*************************" << endl;
}
void showb(int b[3][1])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 1; j++)
{
cout << b[i][j] << ",";
}
cout << endl;
}
cout << "*************************" << endl;
}
void showc(int a[3][3],int b[3][1], int c[3][1])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
c[i][0] += a[i][j] * b[i][0];
}
}
for (int i = 0; i < 3; i++)
{
cout << c[i][0]<<",";
cout << endl;
}
}
int main()
{
int a[3][3] = { 1,2,3,
4,5,6,
7,8,9 };
int b[3][1] = { 4,4,3 };
int c[3][1] = { 0 };
showa(a);
showb(b);
showc(a,b,c);
}