(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;
The answer to the question is available in the PDF file https://www.assignmentexpert.com/https://www.assignmentexpert.com/homework-answers/programming-answer-49934.pdf
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment