Hi folks, i'm doing a program that recieves two matrices from the user and multiply them together. All my code is done except for the multiplication function. I know that i must use "for loops" but how many :S
i'm passint object to be the operand while the the calling object is having the "this" pointer, it goes like this
let A be the first matrice
let B be the second matrice
A.operator*(B);
i have absolutely no idea, this is the function:
ca any one help pleaseCode:Matrix Matrix::operator*(const Matrix& rhs) { Matrix result; //is this correct ? result = *(this)*rhs; if (this == &rhs) { return *this; } else { //Checks if matrices are able to be multiplied if (this->m_Columns == rhs.m_Rows) { //Do multiplication } else { cout << "Cannot perform multiplication." << endl; cout << "Columns of first matrix don't "; cout << "match the rows of the second matrix" << endl; } } return result; }