Hello, I'm making a program that involves the user inputting an equation that my program needs to be able to calculate the value of. Now, I know pretty much for certain that given enough time and patience I could probably have some kind of algorithm that went through the string of the equation and came up with some procedure to calculate the value of it. However, not only is this pretty complicated, I don't have that much time to do it.
So I was wondering, is there was a way to take an inputted string and execute it as though it were code? For example if the person inputted sin(sq(x)) (which can then easily convert that to x = sin(sq(x)); if that's needed), if there was some simple way to execute that.
Failing that, is there some kind of calculator class that can take a string with an equation and come up with a value? Are there other options I'm not seeing?
Thanks for your time!
So I was wondering, is there was a way to take an inputted string and execute it as though it were code? For example if the person inputted sin(sq(x)) (which can then easily convert that to x = sin(sq(x)); if that's needed), if there was some simple way to execute that.
Failing that, is there some kind of calculator class that can take a string with an equation and come up with a value? Are there other options I'm not seeing?
Thanks for your time!
1