Design a class to perform various matrix operations. A matrix is a set of number
ID: 3634430 • Letter: D
Question
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 five rows and six columns, we say that the matrix A is of the size 5x6 and sometimes denote it as A5x6. 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 A = [aij] and B = [bij] are two matrices of the size m x n, in which aij denotes the element of A in the ith row and the jth column, and so on. The sum, difference, increment and decrement are given by:
A + B = [aij + bij]
A - B = [aij - bij]
A++ or ++A= [aij+1]
• Design and implement a class matrixType that can store a matrix of any size.
• Overload the operators +, - and ++ to perform the addition, subtraction and increment operations, resp..
• Overload the operator >> to take input in to a matrix from the user. First ask for the values of first row, then the values of the second row and so on.
• Overload the operator << to output a Matrix in the proper format i.e. each row on a new line and each value separated by whitespace. Also, write a test program to test various operations on the matrices.
TIPS:
-Use dynamic arrays to implement matrix.
-Follow the Rule of Three because we are using dynamic arrays.
- It is your choice to overload the operator using member function or friend function.
- Program asks user for size of A, then it asks the values of the members of A.
- Program asks user for size of B, then it asks the values of the members of B.
- The programs then outputs the sum of A and B, their difference, and then the value the following expression
cout<< ++A - B++;
Explanation / Answer
its not working, all the for loops are incpmlete,kindly correct them and paste
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.