#include #include template class Matrix{ public: TypeName **matrix; int _x, _y; void Input(){ printf("Input matrix %dx%d:\n", _y, _x); for(int y=0;y<_y;y++){ for(int x=0;x<_x;x++) scanf("%d", &matrix[y][x]); } return; } void Print(){ for(int y=0;y<_y;y++){ for(int x=0;x<_x;x++) printf("%d\t", matrix[y][x]); printf("\n"); } return; } Matrix(int y, int x){ _x=x; _y=y; matrix = new TypeName*[_y]; for(int i=0;i<_y;i++){ matrix[i]=new TypeName[_x]; } return; }; Matrix operator*(const Matrix &matr)const{ Matrix nmatrix(_y, matr._x); for(int y=0;y<_y;y++){ for(int j=0;j mf(y1, x1), ms(y2, x2), mres(y1, x2); mf.Input(); ms.Input(); if(mf._y==ms._x){ mres=mf*ms; printf("Result is\n"); mres.Print(); } else{ printf("Unable to multiply matrices.\n"); } system("pause"); return 0; }