This is a C++ project I built to handle systems of linear equations. It takes raw equation strings as input, converts them into a coefficient matrix, and solves them using Cramer's Rule.
- Parsing: It cleans up the input (removes spaces and handles upper/lower case) so you can type equations naturally like
2x1 + 3x2 = 10. - Math Logic: I used Gaussian Elimination to find the determinants needed for Cramer's Rule.
- Precision: Added a small EPS value (1e-9) to handle floating-point rounding errors during calculations.
num_vars: Output the total number of unique variables found in the provided equations.equation i: Output the specific equation stored at index i (where i is an integer).add 1 3: Calculate the sum of equation 1 and equation 3 and print the resulting new equation.subtract 1 3: Calculate the result of (Equation 1 - Equation 3) and print the resulting new equation.D: Print the primary matrix of coefficients (the A in Ax = B).D x1: Print the coefficient matrix where the x1 column has been replaced by the answer-column (constants).D_value: Calculate and print the numerical value of the determinant for the coefficient matrix.solve: Calculate and print the values for each variable. If the system cannot be solved, the program must print "No Solution".
Just compile main.cpp and run it. The first input should be the number of equations, followed by the equations themselves.