Manipulation of Logic clauses using C++

i need help in evaluation of logical clauses(DNF and CNF) using c++.
wat i wan is :
user input a logical clauses as in DNF, then i have to convert it to CNF. and the truth table for both dnf n cnf has to be evaluated.
example:
input is !(A&&!B) , then i will get !A||B as the conversion result, and a truth table evaluating all the true n false with regard to A and B.
A B !(A&&!B) !A||B
1 1 1 1
1 0 0 0
0 1 1 1
0 0 1 1

i was thinking of getting user input as a line of string but then i do not know wat to do next.perhaps further dissecting the string into smallest component and then evaluate one by one and join them ?
such as !(A&&!B) , i break it down into evaluate A first, then !B, and then (A AND !B), finaly evaluate !(A AND B)?
this works for simple clauses. to deal with complicated clauses, a lot of conditions which might seem tedious to do.

i do not require reply of whole programming code,but a reference would be great. Pls suggest any functions n syntaxes which u think are relavent.
thx for ur help.
The approach you thought is right:
such as !(A&&!B) , i break it down into evaluate A first, then !B, and then (A AND !B), finaly evaluate !(A AND B)?

If you can generalize it, you will get the ability of parsing even more complex situations.

You should try with bison+flex, they make parsing really easy.
oh thx for ur reply.
im new to programming, and i do not know what bison and flex is.
but ill googled it, thx for ur recommendation.
Topic archived. No new replies allowed.