0
int main() { int x=3; cout<<(x<5) +1; return 0; }
Explain the output please
2 Answers
+ 1
cout<<(x<5)+1;
here x<5 ,so the output will be 1.
the final answer will be 2 [cout<<(1)+1]
if x<5 statement is true output will be 1
if it is false output will be 0
(its like bool)
+ 1
for argument:
non-zero = true
zero = false
for output:
true = 1
false = 0