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.