Question: matrix class Replace the ?????s #include #include #include #include using namespace std; //This forward declaration of Matrix class is necessary because the following operator>> and
matrix class
Replace the ?????s
#include
//This forward declaration of Matrix class is necessary because the following operator>> and << are using Matrix as a parameter template
//This forward declaration of operator>> is necessary Since operator<< is a template function. template
//This forward declaration of operator<< is necessary Since operator<< is a template function. template
//Template class so we can have a matrix of any data types, int or double template
private: T** m; //2 dimensional dynamic array const int R; //number of rows const int C; //number of columns
public: Matrix(int R, int C); Matrix(); ~Matrix(); void fill(); //filling the matrix Matrix operator*(const Matrix& other);// matrix multiplication class size_error{};//exception class };
//default constructor template
//constructor to create a matrix, row x col template
//m = new T[R][C]; //this doesn't compile m = new T*[R]; //create a single dimensional array of pointers of the T type for (int i=0; i //initialize each element to 0 for(int row = 0; row < R; row++) for(int col = 0; col < C; col++) m[row][col] = 0; } //fill a matrix using an input file template /*output the matrix to screen in the following format. Allocate 5 spaces for each value. 1 1 1 2 2 2 3 3 3 4 4 4 */ template //matrix multiplication template //destructor template
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
