# Boolean Values

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 04-06-2006
guitarman32
Boolean Values
Assume Boolean values have been assigned to A, B, and C as
A= true; B= false; C= True

Indicate wether it is true or false.

(A && B) || (A && C)

How would I go about doing this?
• 04-06-2006
hk_mp5kpdw
Evaluate the (A && B) part
Evaluate the (A && C) part
Evaluate those two results above combined with ||.
• 04-06-2006
n3v
haha, can't you copy your homework off of some dorky kid near you? is that even computer science homework?
either way, i'll explain it.

the equation in question is as follows, assuming A and C are true, and B is not.

Code:

`(A && B) || (A && C)`
here are some rules about dealing with boolean:

in an "and" statement (&&), if any of the values at all are false, the
whole thing is false.

in an "or" statement (||), it checks the value of the first piece of code, and if it is true, it will not read the second piece of code; it will simply mark itself "true." however, if the first segment of code is false, then it will check the second segment. if either of these segments are true, the entire statement is true.

so, in this case, because the whole line of code exists within an "or" statement, we look at the first one first, then if it's false, we look at the second one, and if either of them were true, it's true.

so, the first one, a && b = true && false. one of them is false, so the first segment is false. let's look at the second one.

A && C = true and true, that means this section is true, because none of the values are false.

so, we've got that the first value is false, and the second is true.

the or statement is true if any of the results are true, and one of them is, therefore the entire statement is true.

-n3v
• 04-06-2006
cboard_member
It sounds like Electronics homework to me.
• 04-06-2006
bumfluff
How to write Boolean expressions in the real world:

Z (output) = A.B+A.C

+ = or
. = and
• 04-06-2006
n3v
real world? i assume that's electronics lingo. i've never seen boolean expressions written like that. i thought they were represented with weird little symbols when you deal with them in math.
• 04-06-2006
guitarman32
Hahah thanks guys. Makes more sence now.
• 04-06-2006
bumfluff
yep it was electronic lingo
• 04-06-2006
cboard_member
How do you represent NOT in ASCII - afaik there's no bar.

I guess you could do

_
B.(A+C)

But that's wasting a line.
Meh.

EDIT: wtf I put that underscore over the C, over the goddam C!
• 04-06-2006
bumfluff
I don't think computers were designed to make boolean expressions.
• 04-06-2006
n3v
Quote:

Originally Posted by bumfluff
I don't think computers were designed to make boolean expressions.

haha. instant classic.

hey, wait, i know what you mean:

0 0
1
0001

nope, expressions don't work very well in boolean.
• 04-06-2006
bumfluff
IS that not binary that your are trying to write there?
• 04-06-2006
Rashakil Fol
¬ is the not symbol. It's not part of tha ASCII character set, but it might be part of some 8-bit Windows character set. ~ is sometimes used as a not symbol, too (and I'm not talking about C; I'm talking about in a math class on a chalkboard), so I recommend using that for logic. For and and or, you could use /\ and \/, but base-2 modular arithmetic + and * are equivalent. (And what's with using a period for multiplication?)
• 04-06-2006
bumfluff
Well in the electronic terms that me and ahluka were talking about not is a score over the letter.
• 04-06-2006
n3v
regardless, it doesn't really matter, because we're just using it in c++, where thankfully it's a lot simpler. sort of.

and yeah, that was binary. binary was kind of a representation of boolean values there though. or something.

the thing is though, the only thing computers can really do is make boolean expressions. in binary.
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last