Mar 6, 2018 at 3:34am
Write your question here.
I have the code which creates the matrix, but I am having trouble squaring the matrix I have created.
Mar 6, 2018 at 4:29am
It would be easier to help if you post the code and tell us what trouble are you having.
Mar 6, 2018 at 7:31am
void display (int nums[ROWS][COLS])
{
int rownum, colnum;
for ( rownum = 0; rownum < ROWS; rownum++)
{
for (colnum = 0; colnum < COLS; colnum++){
cout << setw(5) << nums [rownum][colnum];}
cout << setw(5) << nums[rownum][colnum];
cout << endl;
}
return;
}
int main ()
{
int M [ROWS][COLS];
cout << "Enter in 9 elements for a 3x3 matrix." << endl;
cin >> M[0][0] >> M[0][1] >> M[0][2] >> M[1][0] >> M[1][1] >> M[1][2] >> M[2][0] >> M[2][1] >> M[2][2];
return 0;
}
Mar 6, 2018 at 3:22pm
This is my whole code. Sorry, I'm new here haha. Anyway, I have just started programming and I am having difficulties.
Mar 6, 2018 at 3:26pm
and squaring a matrix just means to multiply a matrix by itself.
Mar 6, 2018 at 8:26pm
How does one multiply two matrices? (In math.)