Wednesday, February 3, 2010

Determine if the following expressions are true or false. C++ Boolean Operations.?

x%26amp;%26amp;y II x%26amp;%26amp;z


(xIIy) %26amp;%26amp; (!xIIz)


x II y %26amp;%26amp; z





assume x = true, y = false, z=true





there is no operation here to me. I don't get how to evaluate this.Determine if the following expressions are true or false. C++ Boolean Operations.?
the C++ boolean operators %26amp;%26amp;, || and ! are respectively AND, OR and NOT.


In C++, but also boolean theory and many other languages, the NOT (卢) takes precedence over AND (鈭? which takes precedence over OR (鈭?.





Thus:





1) x%26amp;%26amp;y II x%26amp;%26amp;z = (x AND y) OR (x AND z) = (x鈭)鈭?x鈭)


2) (xIIy) %26amp;%26amp; (!xIIz) = (x OR y) AND (NOT x OR z) = (x鈭▂)鈭?卢x鈭▃)


3) And x II y %26amp;%26amp; z = x OR (y AND z) = x鈭?y鈭)





1) = (x鈭)鈭?x鈭) = (1鈭?)鈭?1鈭?) = 0鈭? = 1


2) = (x鈭▂)鈭?卢x鈭▃) = (1鈭?)鈭?卢1鈭?) = 1鈭?0鈭?) = 1鈭? = 1


3) = x鈭?y鈭) = 1鈭?0鈭?) = 1鈭? = 1

No comments:

Post a Comment