# Answer to Question #49934 in C++ for yolanda

Question #49934

(CODEBLOCKS)

Write a program that takes as input two 3x3 2-D arrays and write the following two functions:

a. getInpt(.): this functions takes input from the user and fills the matrix (or a 2D

array).

b. print(.): this function takes a 2-D arrays as the formal parameter and prints the

results on the screen.

c. addMat( , , ): this function takes two 2-D arrays (or matrices) and finds the sum

of the two matrices and stores the results in the third formal parameter.

d. multMat( , , ): this function takes two 2-D arrays( or matrices) and finds the

product of the two matrices and stores the results in the third formal parameter.

You can use the following main method.

int main( ) {

int mat1[rows][cols], mat2[rows][cols], res[rows][cols];

cout<<"Please enter a 3x3 matrix: "; getInput(mat1);

cout<<"Please enter a 3x3 matrix: "; getInput(mat2);

addMat( mat1, mat2, res);

cout<<"\nSum of matrices: ";

print(res);

multMat( mat1, mat2, res);

cout<<"\nProduct of matrices: ";

print(res);

return 0;

Write a program that takes as input two 3x3 2-D arrays and write the following two functions:

a. getInpt(.): this functions takes input from the user and fills the matrix (or a 2D

array).

b. print(.): this function takes a 2-D arrays as the formal parameter and prints the

results on the screen.

c. addMat( , , ): this function takes two 2-D arrays (or matrices) and finds the sum

of the two matrices and stores the results in the third formal parameter.

d. multMat( , , ): this function takes two 2-D arrays( or matrices) and finds the

product of the two matrices and stores the results in the third formal parameter.

You can use the following main method.

int main( ) {

int mat1[rows][cols], mat2[rows][cols], res[rows][cols];

cout<<"Please enter a 3x3 matrix: "; getInput(mat1);

cout<<"Please enter a 3x3 matrix: "; getInput(mat2);

addMat( mat1, mat2, res);

cout<<"\nSum of matrices: ";

print(res);

multMat( mat1, mat2, res);

cout<<"\nProduct of matrices: ";

print(res);

return 0;

Expert's answer

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment