Dynamic Truth Table

This is a discussion on Dynamic Truth Table within the C Programming forums, part of the General Programming Boards category; Hi everyone. I gotta save the truth table in my .txt file(as a dynamic form), also my inputs and outputs ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    2

    Dynamic Truth Table

    Hi everyone. I gotta save the truth table in my .txt file(as a dynamic form), also my inputs and outputs are here. If i read the .txt file from my program, i can understand what my circuit or gate is. How can i do this ?

    Example:

    .input1 1
    .input2 1

    table
    0 0 0
    0 1 0
    1 0 0
    1 1 1
    table_end

    .output 1


    (content of txt)


    Thanks

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    What do you have so far?

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    2,614
    Read the Tutorials would be a way to start C Tutorial - Learn C - Cprogramming.com

    After you read enough, post your code and your questions about your issues with making your code work to solve your problem.

    Tim S.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  4. #4
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,434
    A simple "if/else if" statement would do the trick
    Think about it -> If "input a" is zero and "input b" is zero, then output is zero...

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,307
    Quote Originally Posted by Lycan View Post
    How can i do this ?
    You're given the two inputs, a table of all possible input combinations, and the resulting output for each combination.
    All you have to do is look up the row that contains the inputs you were given, and take the result from that row.

    Does that make it easy now?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  6. #6
    Registered User
    Join Date
    May 2012
    Posts
    2
    Quote Originally Posted by iMalc View Post
    You're given the two inputs, a table of all possible input combinations, and the resulting output for each combination.
    All you have to do is look up the row that contains the inputs you were given, and take the result from that row.

    Does that make it easy now?
    Yes it easy for that circuit but if the circuit has more gates and more inputs that will be hard. At this statement, how my program will create the truth table for a new circuit ? (btw user choose gates and inputs from the menu)

  7. #7
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Yes it easy for that circuit but if the circuit has more gates and more inputs that will be hard. At this statement, how my program will create the truth table for a new circuit ? (btw user choose gates and inputs from the menu)
    That's not what you said earlier is it?

    So what's the REAL problem and what have you tried?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. truth table
    By sagittarius83 in forum C Programming
    Replies: 15
    Last Post: 10-30-2010, 02:02 PM
  2. XOR truth table
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 02-08-2006, 09:12 AM
  3. program to construct a truth table
    By ashok varma in forum C Programming
    Replies: 2
    Last Post: 08-04-2005, 10:53 AM
  4. logic circuit truth table
    By botakis in forum C Programming
    Replies: 3
    Last Post: 11-18-2004, 10:02 AM
  5. Programming a Truth Table
    By Nitelite in forum C Programming
    Replies: 2
    Last Post: 09-26-2002, 01:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21