● Upload the program before June 6 • Spec: - User inputs two 2x2 matrices. The program multiplies these two matrices and

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

● Upload the program before June 6 • Spec: - User inputs two 2x2 matrices. The program multiplies these two matrices and

Post by answerhappygod »

Upload The Program Before June 6 Spec User Inputs Two 2x2 Matrices The Program Multiplies These Two Matrices And 1
Upload The Program Before June 6 Spec User Inputs Two 2x2 Matrices The Program Multiplies These Two Matrices And 1 (149.87 KiB) Viewed 35 times
● Upload the program before June 6 • Spec: - User inputs two 2x2 matrices. The program multiplies these two matrices and show the product result. - Use pointer notation only. Don't use index notation. • Hint: - Please use the template as shown next page. [AB] × [ ] = [CE + DG CF + DH + BG AF+BH X Exampe: user inputs [1,2;3,4] and [5,6;7,8] to 1st and 2nd matrix respectively. \\Mac\Home... X Please input 1st matrix: 1 2 3 4 Please input 2nd matrix: 5678 Matrixl is: 12 34 Matrix2 is: 5 6 78 The product result is: 19 22 43 50
#include using std::cout; using std::cin; using std::endl; #include using std::setw; Bint main() { const int size = 2; int mat1[size][size] = { 0 }; int mat2[size][size] = { 0 }; int* pproduct = new int[size * size]; // read the matrices cout << "\nPlease input 1st matrix:" << endl; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) cin >> *(*(mat1 + i) + j); cout << "\nPlease input 2nd matrix:" << endl; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) cin >> *(*(mat2 + i) + j); // show the matrices cout << "\nMatrix1 is:" << endl; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) cout <
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply