7 Replies Latest reply on Jul 22, 2008 8:34 AM by GraspDiver

# Truth Tables

I have to do an assignment for my computer programming class regarding truth tables and I do not understand the concept behind it all. If someone can give me an explanation of this, I would really be thankful. You can find the assignment here. I just don't get it.
• ###### 1. Re: Truth Tables
anyone?
• ###### 2. Re: Truth Tables
You perform the operation dictated by the logic in each task to find the value of X

so if for example X = A+B, simply add the value of A and B to find X
• ###### 3. Re: Truth Tables
but lets say, with problem 1...
X = a + b + c

what happens when
a = 0
b = 1
c = 1

x can't be 2.. would it just be 1?
• ###### 4. Re: Truth Tables
EX
var a:int = 0;
var b:int = 1;
var c:int = 1;

var d:int = a+b+c;

// d = 2
• ###### 5. Re: Truth Tables
this is more so boolean math instead of just simply adding numbers. 0 = false, 1 = true. my professor explained the logic behind this and i understand it now. thanks for trying your hand at helping me out.
• ###### 6. Re: Truth Tables
A truth table is a matrix (no not a movie). Say you have an alarm on a chicken coop door and you want to know when the chickens are in the coop and when the door is open to warn you that a fox could get in. The truth table shows the states of the door (open or closed) and the states of the chickens (in or out). so your truth table would be:

doorOpen doorClosed
chickensIn 1 0

chickensOut 0 0

the only time the alarm would go off is when the chicken are in the coop and the door is open. so your code would be:

if (chickensIn and doorOpen) {goCleseThe Door;}
• ###### 7. Re: Truth Tables
ok, the replay screwed up the formatting, but hopefully u get the drift.