2: input/output: input with operation of two matrices, the output result
Add: 3: matrix determine whether two matrices can be combined, such as, calculating the sum of two matrices, and the result output
4, 5 by reduction condition with 3
6, the number of matrix and multiplication: enter the Numbers, matrix and the number of each product, as a result, the output
7: matrix transpose: calculate each matrix transpose, result output
#include
3 # define R
using namespace std;
The class Matrix
{
Public:
int i,j;
Matrix (int a);
Friend Matrix operator + (Matrix & amp; a);
Friend Matrix operator - (Matrix & amp; a);
Friend Matrix operator * (Matrix & amp; a);
Friend Matrix shucheng (Matrix & amp; a);
Friend Matrix zhuanzhi (Matrix & amp; a);
Private:
Int p [R] [R].
};
Matrix: : Matrix ()
{
for(int i=0; i
for(int j=0; j
}
}
Matrix& Matrix: : operator + (Matrix & amp; A)
{
Matrix c;
{
for(int i=0; i
for(int j=0; j
return c;
}
}
}
Matrix& Matrix: : operator - (Matrix & amp; A)
{
Matrix c;
For (int I=0; i
For (int j=0; j
C.p [I] [j]=p [I] [j] - Amy polumbo [I] [j];
return c;
}
}
}
Matrix& Matrix: : operator * (Matrix & amp; A)
{
Matrix c;
For (int I=0; i
For (int j=0; J & lt; R; J++)
{
For (int k=0; K
return c;
}
}
}
Matrix& Matrix: : shucheng (Matrix & amp; A)
{
Int b;
For (int I=0; i
For (int j=0; J & lt; R; + + j)
{
C.p [I] [j]=b * Amy polumbo [I] [j];
return c;
}
}
}
Matrix Matrix: : zhuanzhi (Matrix & amp; A)
{
Matrix m, n;
M=a;
For (int I=0; i
For (int j=0; J & lt; R; + + j)
Nancy (polocy) pelosi [I] [j]=m.p [I] [j];
Return n.
}
}
Int main ()
{
Matrix a, b, c, d, f, e, g, X, k;
A, b, c, d, e, f, g;
cin> A;
cin> b;
C=a + b;
D=a - b;
E=a * b;
F=X * a;
G=X * b;
Cout<& lt; Endl<" Matrix a is: "& lt;
}