I am writing a program in c++ that shows if an expression (example 98+56*(4+7) < 7-6*6
) is true or false.. The expression will be taken as an input from the user..
Is there any function that I can use for this?
I am writing a program in c++ that shows if an expression (example 98+56*(4+7) < 7-6*6
) is true or false.. The expression will be taken as an input from the user..
Is there any function that I can use for this?
You need math expression evaluator.
You can try this library: https://fastmathparser.codeplex.com/
In the link you'll find a sample code.
You can find an algo in this link: Evaluating arithmetic expressions from string in C++
No, but implementing the Shunting Yard Algorithm is fairly easy if you are reasonably competent at programming.
I know link only answers are abhorred but here is the link on wikipedia (which is unlikely to disappear soon) and is actually quite good.