Design a to perform various matrix operations class a


Design a to perform various matrix operations. class 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 theith 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.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a to perform various matrix operations class a
Reference No:- TGS0661533

Expected delivery within 24 Hours