Program that takes a Sum of Products and generates the Sum of Minterms

Have this homework assignment and I seriously don't even know where to begin. Any sort of help will be appreciated.

Here is the assignment:

Write a C/C++ program that reads a boolean expression in sum-of-products form and generates the sum-of-minterms form (canonical form). Use single letter to represent variables. The following symbols will be used to represent operators: NOT: ~, AND: *, OR: +. Other operators won't be used.

Examples of execution:
number of variables: 2
SOP expression: ~A+B
output: ~A*~B + ~A*B + A*B


number of variables: 3
SOP expression: x*y*z + ~x*~y + y*~z
output: x*y*z + ~x*~y*z + ~x*~y*~z + x*y*~z + ~x*y*~z
Start by introducing types for the logical operators you'll need and writing something to parse well formed input. What features of the language are you allowed to use? Can you use classes? What about inheritance?
Can use anything as long as it works. Class isn't really even a c++ class, my teacher just loves giving us programs, and honestly this is probably way out of my league.
Can use anything as long as it works.

Ok. Then, what features of the language are you comfortable with? Since the expressions you are given and requested to generate have a very specific structure, you might be able to get away with using just a vector of vectors [1] of strings [2] as their internal representation, instead of implementing an object oriented solution. The latter though might be useful if your teacher decides to give you other similar and perhpaps more difficult problems.

[1] http://www.cplusplus.com/reference/vector/vector/
[2] http://www.cplusplus.com/reference/string/string/
Last edited on
Topic archived. No new replies allowed.