I don't know how do this. I know that there are 4 "for" statements...but how????? Can anyone help me...please.. If you don't know what I mean...
What I suggest is you research matrix multiplication. It is not too difficult once you get the hang of it. Matrix A's Cols must = the Matrix B's rows to do a cross product. You multiply a11 with b11 and add it to a12 x b21 where the first number a11 represents row and the second number a11 represents column.
int matrixA[3][2];
int matrixB[2][3];
int matrixC[3][3];
memset(matrixC,0,sizeof(int)*3*3);
int col = 0;
int row = 0;
for(int i = 0; i<3;i++)
{
for(int j = 0;j<2;j++)
{
matrixC[col][row]+= matrix[i][j];
col++;
if(col == 3)
{
col = 0;
row++;
}
}
}
sorry for the mis-interpretation, I got side tracked and thought you were asking how to do matrix multiplicaiton.
Matt
MAN... 2 for 2... sorry bout not putting in the code tag once again... in need more coffee
I think this should do the trick
Sorry, to do it with C++ you would have arrays
Code:
int matrixA[3][2];
int matrixB[2][3];
int matrixC[3][3];
memset(matrixC,0,sizeof(int)*3*3);
int col = 0;
int row = 0;
for(int i = 0; i<3;i++)
{
for(int j = 0;j<2;j++)
{
matrixC[col][row]+= matrix[i][j];
col++;
if(col == 3)
{
col = 0;
row++;
}
}
}
sorry for the mis-interpretation, I got side tracked and thought you were asking how to do matrix multiplicaiton.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.