Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a function to add two matrices, and (b) and save the result in . The function should accept the two matrices as parameters and
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started