How to format output

I'm super new at this and need a little help. I don't want answers just some help

Q: What is output of expressions(a)&(b):
bool p = true, q = false, r = true
(a) ! ((r||q)&&(p&&q))
(b) (p&&!q) || (!p ||q);
A:
(a) = ! true or false and true or false
(b) = true and ! false or !true or false

I don't really understand how to format?
Q: What is output of expressions(a)&(b):


Try writing some code to test them, piece by piece - this is the best way to learn. The output will be 0 for false anything else for true.

There is std::boolalpha which will output true or false literally. The ! operator reverses the logic. Have you heard of truth tables for logical functions? Google / wiki them if you haven't .

http://www.cplusplus.com/reference/ios/boolalpha/?kw=boolalpha

Good Luck !!
Last edited on
Topic archived. No new replies allowed.