Question: In this problem, you will write a C++ program which gets two matrices A and B from the user and which executes the multiplication of

In this problem, you will write a C++ program which gets two matrices A and B from the user and which executes the multiplication of A by B :

- Write the function getData( int r, int c, double matrix[][] ) { } which gets the inputs to store in the array matrix with r rows and c columns.

- Write the function displayMatrix( int r, int c, double matrix[][]) { } which displays the matrix.

Example : double matrix[2][3] = {1, 2, 3, 4, 5, 6}

the function should output the following

1 2 3

4 5 6

- Write the function multiply(int r1, int c1, double m1[][], int r2, int c2, double m2[][] , double result[][] ) { } which performs the multiplicationm1m2m1m2 only when c1 == r2 and stores the resulting matrix in the variable result.

For more information on matrix multiplication, refer to https://en.wikipedia.org/wiki/Matrix_multiplication

- Write the main function which defines three matrices A, B, C.You may assume that A and B do not contain more than 3 rows and 3 columns. For instance A could be a matrix with 2 rows and 3 columns and B is a matrix 3x3.

Have your program

get two inputs row and column of matrix A

call the function getData to get the data for the matrix A

get two new inputs for the row and column of matrix B

call the function getData for matrix B

call the function multiply( ) to get the multiplication of A by B, and to have the resulting matrix store in C.

output the matrix C.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!