1. Engineering
  2. Computer Science
  3. write a function to add two matrices and b and...

Question: write a function to add two matrices and b and...

Question details

write a function to add two matrices, and (b) and save the result in ⓒ. The function should accept the two matrices as parameters and return their addition through the use of a 3rd parameter. reference parameter for the output matrix. Note that by default, arrays are pass by pointer, which works similarly to pass by reference, except there is no extra syntax (&) needed when defining the parameter. We will learn more about pointers later in this course (enazz an)-(bu ha ha)-(11+b a11 a12 a13b b2 bi3 021 a22 a23 a31 a32 a33/ Each element cy is aj+ bi, Write a test program that prompts the user to enter two 3 x 3 matrices and displays their addition. Here is a sample run: Enter matrix1: 1 234 5 6789k Enter matrix2: 0 2 4 1 4.5 2.2 1.1 4.3 5.2 nter The addition of the matrices is 1 4 7 1 23 02 456 + 1 4.5 2.259.5 8.2 789 1.1 4.3 5.2 8.1 12.3 14.2 Your program should also: Use constants where appropriate. Use appropriate datatypes for representing the program information. Use comments for documentation purposes. Use proper indentation and code structure. Use meaningful, descriptive variable names
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution