Write your question here.
I have the code which creates the matrix, but I am having trouble squaring the matrix I have created.
It would be easier to help if you post the code and tell us what trouble are you having.
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;
}
This is my whole code. Sorry, I'm new here haha. Anyway, I have just started programming and I am having difficulties.
and squaring a matrix just means to multiply a matrix by itself.
How does one multiply two matrices? (In math.)