Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by lalalala ( 16 years ago )
Matrix *mul(const Matrix *p_ml, const Matrix *p_mr){
if ((p_ml->getColumns() == p_mr->getRows()) && (p_ml->getRows() == p_mr->getColumns())){
Matrix *ergebnis = new Matrix (p_mr->getRows(), p_ml->getColumns());
double wert = 0;
int anzahlRow = 1;
for (int i = 1; i <= p_ml->getColumns(); ++i){
for (int j = 1; j <= p_ml->getRows(); ++j){
wert = wert + p_ml->get(j,i)*p_mr->get(i,j);
cout << j << ".Multiplikation: " << wert << "\n";
ergebnis->set(anzahlRow,i,wert);
anzahlRow++;
}
wert = 0;
}
cout << "Ergebnis der Multiplikation zweier Matrizen: \n" ;
ergebnis->print();
}
else {
cout << "Die Matrizen koennen nicht multipliziert werden.\n";
return NULL;
}
}
Revise this Paste