Could anyone explain this code...? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Could anyone explain this code...?

int x=7, y=4; if(++x>6||++y<5) cout<<x<<y; else cout<<x*y;

6th Jun 2017, 10:58 PM
JAMSHAID FAROOQ
JAMSHAID FAROOQ - avatar
4 Answers
+ 7
x = 7. y = 4. ++x > 6 ??? 8 > 6?? True || ... True, moving on. cout<< 8 << 4;. Output: 84 The condition after the 'or' was never evaluated before the 'or' because it didn't matter. The first condition was true anyway.
6th Jun 2017, 11:20 PM
Rrestoring faith
Rrestoring faith - avatar
+ 5
@Yash Yes.
7th Jun 2017, 12:02 AM
Rrestoring faith
Rrestoring faith - avatar
0
Thank you very much...👍👌👏💜
7th Jun 2017, 12:27 AM
JAMSHAID FAROOQ
JAMSHAID FAROOQ - avatar
0
wow
8th Jun 2017, 11:13 PM
Mark
Mark - avatar