This project takes a string input that represents a matrix and transforms it into a 2D array and perform operations on it. Project was done initially in C++98 that has a lot of code limitaions.
The matrix calculator that supports all necessary operations that can be done on Matrices.
Operations that will be supported are:
- Addition
- Subtraction
- Multiplication
- Multipling Matrix by Scalar
- Transpose
- Determinant
- Inverse
The matrix should be entered by the user in the following format: [1 2 5, -1 8 14.2, 7.01 -18 99.3] which is the format equivalent to a 3x3 matrix as shown:
User can choose between the different operations as follows:
In case of Addition: user uses '+' symbol between the two matrices as follows:
In case of subtraction: user uses ' - ' symbol between the two matrices.
In case of multiplication of a matrix by a scalar, the user can begin with either the matrix or the scalar (as he wishes), with the multiplication operator between them.
In case of multiplication of a matrix by another matrix, the input is done as similar to the addition and subtraction step.
In case of Transpose: user types one matrix only then enters capital ‘T’ letter as shown:
In case of Determinant: user types one matrix only then enters capital ‘D’ letter, and the ouput should be shown as a number.
In case of Inverse: user types one matrix only then enters capital ‘I’ letter as in the case of transpose.
User will input string as shown previously.
Example for a 3x4 matrix, it should be witten as follows [-0.1 2 5, -1 8 14.2, 7.01 -18 99.3, 15.0 -99.24 18]
User will input the matrix of size nxm; where: 0<n<100 and 0<m<100
The matrix will have numbers constrained by the following: each value v inside the matrix lies in the range of -9999.999<v<9999.999
If the user enters a matrix in an incorrect format (other than the stated input format) your program must detect that and output the word "ERROR!" For Example:
Your program should validate the mathematical conditions to do the different operations, for example: In addition and subtraction, both matrices should have the same dimensions. If not, your program should output an "ERROR!" message. Also, in case of multiplication for example, your program should check that the dimesions are compatible with each other and that the multiplication can take place correctly. If not, your program should output an "ERROR!" message. For Example:
The output should be a matrix of the result printed on a new line as shown previously.
Also, the error message should be in the following format: "ERROR!" on a new line as shown in the examples above.
NOTE: In the case of decimal point output, you should set the precision of the output to 2 decimal point places.
This project was my first challenge in my Computer Engineering studies. I had no coding experience before it and I had no idea what to do until the day before deadline. I planned to stay awake for 24 hours and try to implement this huge project. Somehow I managed to do most of it correctly. Of course some functionalities are not working perfectly but I don't mind. I always look at this project and remember that everything eentually passes, no matter how hard it is. ❤️