Can anyone explain this to me easily | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone explain this to me easily

bool t = true; bool f = false; bool cond = !t && (f || t) || (t && !f); if (cond) cout << "1"; else cout << "0";

31st Aug 2020, 9:09 PM
Bayzid
Bayzid - avatar
1 Answer
+ 4
Parenthesis are always treated first.They have priority.so then cond or condition : !t &&(f||t) ==> not true and true ==> false false || (t&&!f) ==> false ou true ==> true so cond is true output will be I
31st Aug 2020, 9:23 PM
HBhZ_C
HBhZ_C - avatar