-->
当前位置:首页 > 题库

PROGRAMMING:Use two-dimensional array to realize matrix.

Luz5年前 (2021-05-10)题库426
Use two-dimensional array to realize matrix.
```
1. Define the matrix class. The requirements are as follows:
a) Variables: matrix (int type two-dimensional array), row (number of rows), column (number of columns);
b) Method: realize the multiplication of two matrices, all methods will return the result matrix after operation( Multiplication of two matrices: an M × The matrix A (m, n) of n is multiplied by an n × The matrix B (n, P) of P will get an M × The matrix C (m, P) of P. The number of rows and columns of a matrix is self-determined.)
c) Define the construction method.

2. Write the main class and test the matrix class. It includes: building objects, testing each method, and outputting test results to the screen.
```
###Input format:
Enter the number of rows, columns, and matrix in the following format:
Matrix 1:
```
2 3
1 2 3
4 5 6
```
Matrix 2:
```
3 2
7 8
9 0
1 2
```
###Output format:
Output the product matrix in the following format, with a space character and carriage return after each line:
```
28 14
79 44
```
###Input example:
```in
2 3
1 2 3
4 5 6
3 2
7 8
9 0
1 2
```
###Output example:
```out
28 14
79 44
```






answer:If there is no answer, please comment