How do I find product of the matrices?
Hi
I'm trying to learn to find the product of two matrices using arrays. Please help me. I'm really stuck. And please don't introduce those topics which I won't be able to understand (I'm a beginner). In other words, please keep it simple. Thanks.
Code:
// product_of_two_matrices_1x3_and_3x1.cpp
// read two matrices and find product
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
float m1[1][3];
float m2[3][1];
float m3[1][3];
int r, c;
cout << "Enter matrix #1 below\n\n";
for ( r=0; r<1; r++)
{
for (c=0; c<3 ; c++)
{
cout << "enter entry for row #" << (r+1) << " and column"
<< " #" << (c+1) << ": ";
cin >> m1[r][c];
}
}
cout << "\n\nEnter matrix #2 below\n\n";
for ( r=0; r<3; r++)
{
for (c=0; c<1; c++)
{
cout << "enter entry for row #" << (r+1) << " and column"
<< " #" << (c+1) << ": ";
cin >> m2[r][c];
}
}
cout << "\n\nproduct of matrix #1 and matrix #2 is given below\n\n";
//How do I find product of the matrices?
return 0;
}