Question: plz modify the code below. Need to make more OOP. Please: 1. Create a class called Matrix 2. Creat two methods initMatrix () { }
plz modify the code below. Need to make more OOP. Please:
1. Create a class called Matrix
2. Creat two methods initMatrix () { } (to initialize) and printMatrix() { } (to print)
3. create the object with the following code in the main: Matrix M1;
#include "stdafx.h"
#include
#include
using namespace std;
int main() {
int size, m, n, c, d, first[10][10], second[10][10], sum[10][10];
cout
cin >> size;
m = size; n = size;
cout
for ( c = 0 ; c
for ( d = 0 ; d
cin >> first[c][d];
cout
for ( c = 0 ; c
for ( d = 0 ; d
cin >> second[c][d];
for ( c = 0 ; c
for ( d = 0 ; d
cout
for ( c = 0 ; c
for ( d = 0 ; d
cout
cout
cout
system ("pause");
return 0;
}
The output will look the same because the functionality remains the same. See beloww.
Enter the nunber of rows and columns of matrices Enter the elements of first natrix: 1 2 3 4 Enter the elements of second matrix: 1 2 3 4 Sun of entered natrices Hit any key to continue Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
