Question: Note/ I need the code in C++ Language please ! CENG 241 LAB WORK11 QUESTIONS Question: Write a C++ program that has following Template class:

 Note/ I need the code in C++ Language please ! CENG241 LAB WORK11 QUESTIONS Question: Write a C++ program that has followingTemplate class: template Matrix ** matrict: M_type -** matrix2: M_type -rows int

Note/ I need the code in C++ Language please !

CENG 241 LAB WORK11 QUESTIONS Question: Write a C++ program that has following Template class: template Matrix ** matrict: M_type -** matrix2: M_type -rows int -cols, int +Matrix(): Default Constructor +Matrix(const int &row,const int &col) Overloaded Constructor + Matrix) destructor *printMatrix10): void +printMatrix20): vold +addMatrix0 void +findElements(void +operator (const int &index). M_type*& +getRow: int +getColl): int +setRow(int) *setColfint) Class Variables: . M_type **matrix1: 2 dimensional dynamic array for first matrix. . M_type**matrix2: 2 dimensional dynamic array for second matrix. Int rows: Number of rows for matrices. . Int cols: Number of columns for matrices. Class Functions: Matrix(): This is default constructor of Matrix class. takes integer row Matrix(int row, int col): Overloaded constructor of Matrix class. and column values as parameters. . -Matrix(): This is destructor class that should free memory by deleting dynamic arrays of Matrix class. void findElements(M_type value): This function let user find any element in both matrices. Function takes M_type value as a parameter and finds the element in the CENG 241 LAB WORK11 matrices. Then, prints the index numbers for each occurrence and total frequency that are found in both matrices. . void add Matrix(): This functions simply adds two matrices of Matrix class. Then, prints the added matrix to the screen. . void inputMatrix10: In this function, you should get inputs from the user for elements of first matrix. void inputMatrix2(): In this function, you should get inputs from the user for elements of second matrix. . int getRow(): This function returns number of rows for the matrices. . int getCol(): This function returns number of columns for the matrices. void setRow(int row): This function changes number of rows for the matrices. . void setCol(int col): This function changes number of columns for the matrices. . void printMatrix 10: This function prints the elements of first matrix. void printMatrix20): This function prints the elements of second matrix. . M_type*& operator (const int &index): This is an overloaded operator for "U" operator. It should return the value according to the given indices. You should use Assert() function to check that index>=0 and index

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 Databases Questions!