Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows and columns. Therefore, every element of a matrix has a row position and a column position. If A is a matrix of 5 rows and 6 columns, we say that matrix A isof the size 5 × 6 and sometimes denote it as A5×6. Clearly, a convenient place to store a matrix is in a two-dimensional array. Two matrices can be added and subtracted if they have the same size. Suppose that A = [aij] and B = [bij] are two matrices of the size m × n, where aijdenotes the element of A in the ith row and the jth column, and so on. The sum and difference of A and B is given by: ?+ ?= [???+ ???]?− ?= [???−???]The multiplication of A and B (A * B) is defined only if the number of columns of A are the same as the number of rows of B. If A is of the size m × n and B is of the size n × t, then A * B = [cik] is of the size m × t and the element cikis given by the formula: ???= ??1?1?+ ??2?2?+ ⋯+ ??????Matrices A and B are equal if they are of the same size and elements aij, bij. Have the same values. Design and implement a class matrixType that can store a matrix of any size (dynamic allocation). Your class should have the following attributes: -Number of rows (type integer). -Number of columns (type integer). -A pointer to pointer to store the elements of the matrix (type array) The class should provide the following member functions. -A parametrized constructor to dynamically allocate the matrix on size n × m. the constructor should take two integer values that represent rows and columns as parameters. -A destructor to deallocate the dynamically allocated arrays. -Overload the operators +, -, * and == to perform the addition, subtraction, multiplication, and comparison operations, respectively. -Overload the operators >> to insert a matrix and << to output a matrix. Also, write a test program to test various operations on matrices.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY