You are here:

C++/C input recognition

Advertisement


Question
Hello.
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?


Answer
Hello 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

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.