Results 1 to 2 of 2

Thread: C++: building a special truth table

  1. #1
    Join Date
    Dec 2009
    Beans
    548

    C++: building a special truth table

    Hi,
    I would like to generate a "truth table" in which are present only certain configurations. If I have two variables x,y of cardinality 2,3 then I need to build the truth tables as:

    Code:
    x
    0 1 
    1 0
    y
    0 0 1
    0 1 0
    1 0 0
    The final truth table is the composition of the previous:

    Code:
    xy
    0 1 0 0 1
    0 1 0 1 0
    0 1 1 0 0
    1 0 0 0 1
    1 0 0 1 0
    1 0 1 0 0
    I thought about a variable number of nested loop to build the table. Do you have suggestions? Thank you for help.
    Last edited by erotavlas; November 29th, 2012 at 09:18 AM.

  2. #2
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,285
    Distro
    Kubuntu

    Re: C++: building a special truth table

    And I would love to get rewarded for every time someone asks for help with their school work.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •