I want to write a calculator console program where I would be able to type in a mathematical formula, for example 2*5+3/1, and where it would then upon pressing enter output the answer, in this particular case 13. Also, I want it to have preset constants where for example I might set x=6 in the code, and then when the program runs I type 5*x and it would output 30.
I have been thinking about how to go about doing this and I don't think I know enough C++ to know a solution. I am assuming that when I type * that I would have to find someway to treat this character like one would use a variable in C++, but I don't know how to do this. This seems like such a simple thing to do though and so I am assuming there must be some standard method out there for accomplishing this in C++ that I am not aware of since there are already programs like Wolfram alpha out there that do just this.