Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will accept two n by n matrices from the user, multiply the

ID: 3618007 • Letter: W

Question

 Write a program that will accept two n by n matrices from the user, multiply 
the two matrices and print the product matrix in tabular format. The product Z
of two n by n matrices X and Y is defined by

z(i,j) = Sum ( X(i,k) * Y(k,j) ) for all k, where 0 <= {i, j} <= n-1 .

The matrix entries are all integers. The maximum matrix size to be supported is
20x20.

Example Program output:

R: eachingCSC175F2007Homeworkshw11>hw11-q2.exe
Matrix size to be multiplied? : 3
Matrix 1, ([ row ][ column ]) [ 1 ][ 1 ] = 1
Matrix 1, ([ row ][ column ]) [ 1 ][ 2 ] = 2
Matrix 1, ([ row ][ column ]) [ 1 ][ 3 ] = 4
Matrix 1, ([ row ][ column ]) [ 2 ][ 1 ] = 3
Matrix 1, ([ row ][ column ]) [ 2 ][ 2 ] = -1
Matrix 1, ([ row ][ column ]) [ 2 ][ 3 ] = 6
Matrix 1, ([ row ][ column ]) [ 3 ][ 1 ] = 4
Matrix 1, ([ row ][ column ]) [ 3 ][ 2 ] = -6
Matrix 1, ([ row ][ column ]) [ 3 ][ 3 ] = 2

Matrix m1:
1 2 4
3 -1 6
4 -6 2

Matrix 2, ([ row ][ column ]) [ 1 ][ 1 ] = 0
Matrix 2, ([ row ][ column ]) [ 1 ][ 2 ] = 3
Matrix 2, ([ row ][ column ]) [ 1 ][ 3 ] = -5
Matrix 2, ([ row ][ column ]) [ 2 ][ 1 ] = 1
Matrix 2, ([ row ][ column ]) [ 2 ][ 2 ] = 1
Matrix 2, ([ row ][ column ]) [ 2 ][ 3 ] = -2
Matrix 2, ([ row ][ column ]) [ 3 ][ 1 ] = 5
Matrix 2, ([ row ][ column ]) [ 3 ][ 2 ] = -2
Matrix 2, ([ row ][ column ]) [ 3 ][ 3 ] = 7

Matrix m2:
0 3 -5
1 1 -2
5 -2 7

Product m3 = m1 * m2
22 -3 19
29 -4 29
4 2 6

R: eachingCSC175F2007Homeworkshw11>


============================
Note: Matrix multiplication details for 3x3 matrices for three different cells
in the resulting matrix, m3:


m3[0][0] = m1[0][0] * m2[0][0] + m1[0][1] * m2[1][0] + m1[0][2] * m2[2][0]
= 1 * 0 + 2 * 1 + 4 * 5
= 22


m3[0][1] = m1[0][0] * m2[0][1] + m1[0][1] * m2[1][1] + m1[0][2] * m2[2][1]
= 1 * 3 + 2 * 1 + 4 * -2
= -3


m3[2][1] = m1[2][0] * m2[0][1] + m1[2][1] * m2[1][1] + m1[2][2] * m2[2][1]
= 4 * 3 + -6 * 1 + 2 * -2
= 2



For the 3x3 matrix:

m[0][0] m[0][1] m[0][2]
m1 = m[1][0] m[1][1] m[1][2]
m[2][0] m[2][1] m[2][2]
============================================



Explanation / Answer

please rate - thanks #include #include using namespace std; void input(int[20][20],int,string); void MultArrays(int[20][20], int[20][20],int[20][20],int); using namespace std; int main() { int n,i,j;       int a[20][20],b[20][20],c[20][20]; coutn; input(a,n,"Matrix 1"); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote