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?

Printable View

- 04-06-2006guitarman32Boolean 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-2006hk_mp5kpdw
Evaluate the (A && B) part

Evaluate the (A && C) part

Evaluate those two results above combined with ||. - 04-06-2006n3v
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)`

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-2006cboard_member
It sounds like Electronics homework to me.

- 04-06-2006bumfluff
How to write Boolean expressions in the real world:

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

+ = or

. = and - 04-06-2006n3v
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-2006guitarman32
Hahah thanks guys. Makes more sence now.

- 04-06-2006bumfluff
yep it was electronic lingo

- 04-06-2006cboard_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-2006bumfluff
I don't think computers were designed to make boolean expressions.

- 04-06-2006n3vQuote:

Originally Posted by**bumfluff**

hey, wait, i know what you mean:

0 0

1

0001

nope, expressions don't work very well in boolean. - 04-06-2006bumfluff
IS that not binary that your are trying to write there?

- 04-06-2006Rashakil 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-2006bumfluff
Well in the electronic terms that me and ahluka were talking about not is a score over the letter.

- 04-06-2006n3v
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.