Introduction of Msolve.hpp:

This is a c++ header file help us to calculating a function using formula for long equation.

After importing Msolve.hpp header file we use Msolve (formula[string],var1,var2,var3....) function.

operation can be solve Addition(+), Subtraction(-), Multiplication(astric symbol), Division(/), Modulus(%), Power of(^). allowed string: NUM, '(', ')', '+', '-', '/', '%', '^',and astric symbol.

Here some example:


cout << Msolve("-1-2-3+4+3+5-08+78+54") << "\n";


int x0 = 78;

cout << Msolve("-1-2-3+4+3+5-08+" + to_string(x0) + "+54") << "\n";


string x1 = to_string(x0);

cout << Msolve("-1-2-3+4+3+5-08+" + x1 + "+54") << "\n";


cout << Msolve("(ab2+ d_y tc-r+2.0)", 1, 2, 3) << '\n';

//ab2=1, d_y tc=2,r=3;

this format is my choice, use it.

How to compile:

 to compile this program you need to type:

g++ -std=c++17 main.cpp -o abc

and run abc.exe in cmd, Only type


and press enter.

Click here to download Msolve.hpp