Question: write a main.cpp and math.cpp that compile with the header file that creates a class that stores and manipulates matrices and develop operator overloads. header


write a main.cpp and math.cpp that compile with the header file that creates a class that stores and manipulates matrices and develop operator overloads.

header file:

#ifndef MATH_H #define MATH_H

#include using namespace std;

class Matrix_Class { public: Matrix_Class(); // Default Constructor Matrix_Class(const int r, const int c=6); // Constructor ~Matrix_Class(); // Destructor void Clear(); // Delete Matrix void Zero(); // Set all values to zero void Print( string msg)const; // Print Matrix to Stdout void Input(); // Input Matrix from Stdin void Resize(const int r, const int c); // Clear and resize to row and col int Getrowsize() { return rowsize; } // Inline function to return rowsize int Getcolsize() { return colsize; } // Inline function to return colsize

Matrix_Class & operator = (const Matrix_Class & m); Matrix_Class & operator * (Matrix_Class & m1);

private: int * * matrix; // 2d array that holds the matrix int rowsize; int colsize; };

Sample Output:

Enter 4 numbers for Row1:1 1 1 1 Enter 4 numbers for Row2:2 2 2 2 Enter 4 numbers for Row3:3 3 3 3 Enter 4 numbers for Row4:4 4 4 4 Enter 4 numbers for Row1:1 1 1 1 Enter 4 numbers for Row2:2 2 2 2 Enter 4 numbers for Row3:3 3 3 3 Enter 4 numbers for Row4:4 4 4 4 Matrix Output Matrix1 after input Row size = 4 Column Size = 4 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 Matrix Output Matrix2 after input Row size = 4 Column Size = 4 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 Enter 3 numbers for Row1:1 2 3 Enter 3 numbers for Row2:4 5 6 Enter 3 numbers for Row1:7 8 9 Enter 3 numbers for Row2:10 11 12 Enter 3 numbers for Row3:13 14 15 Multiplying matrix of size 2x3 Matrix Output Duplicate Multiplication Row size = 2 Column Size = 3 66 72 78 156 171 186




Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!