C++/C input recognition
Expert: Zlatko - 9/18/2010
QuestionHello.
I'd like to know a way in which we can accept a boolean function from the user, and perform operations on it. The function can be of the form sum-of-products, product-of-sum, or even a hybrid. for eg. a(b+c)+bc+ac'
What would be the logic in recognizing the different terms? May I have a sample code snippet to go with it also?
AnswerHello Ayush
Awesome question.
The short answer is to use the shunting algorithm.
See
http://en.wikipedia.org/wiki/Shunting-yard_algorithm
The long answer is longer. If you want the long answer please post the question directly to me. If you post the question to me, I will then take the time to write a longer answer on my site
https://sites.google.com/site/zlatkoscodingtopics/
Best regards
Zlatko