Write a program that does the following matrix operation: op1 and op2. For examp
ID: 3652877 • Letter: W
Question
Write a program that does the following matrix operation: op1 and op2. For example, given 2*2 matrix A and matrix B, op1 is defined as follows: A1 B1 A2 B2 A1A2 + B1 C2 A1 B2 + B1 D2 op1 = C1 D1 C2 D2 C1A2 + D1C2 C1 B2 + D1 D2 (1) And op2 is defined as follows: A1 B1 A2 B2 A1 A2 B1 B2 op2 = C1 D1 C2 D2 C1C2 D1 D2 (2) In the main function do the following: Declare 3 4*4 2-D integer arrays (A, B, and Result) Get the dimension of the 2 matrices from the user (same size for both A and B, they are all square matrices) Get the values of the 2 matrices from the user, 1 row at a time Call function printMatrix to print matrix A Call function printMatrix to print matrix B Call function matrixOP1 to compute A op1 B, the result is put in matrix Result Call function printMatrix to print matrix Result Call function matrixOP2 to compute A op2 B, the result is put in matrix Result Call function printMatrix to print matrix Result Function prototypes are given as follows: Void printMatrix (int [][4], int dimension); Void matrixOP1 (int result[][4], int a[][4], int b[][4], int dimension); Void matrixOP2 (int result[][4], int a[][4], int b[][4], int dimension);Explanation / Answer
void matrixOP1(int result[][4],int a[][4],b[][4],int dimension) { int c, d, k, sum = 0; for ( c = 0 ; cRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.