+ 1

So lately I've been seeing this: x=3 cout << (x<5)+1 on my challenge. How are you supposed to do this? On c++

There was also something like (!(x>0)||(x>y) How do you do it

9th Aug 2017, 12:54 PM
HJ🐓TDM
3 Respostas
+ 1
Conditionals are evaluated to 1 if true, 0 if false.
9th Aug 2017, 4:45 PM
Denis Felipe
Denis Felipe - avatar
0
x = 3; bool temp1 = x < 5; //true int temp2 = int(temp1); //1 int temp3 = temp2 + 1; //2 cout << temp3; bool temp1 = x > 0; bool temp2 = !temp1; bool temp3 = x > y; bool result = temp2 || temp3; Step by step, as fast as you can.
9th Aug 2017, 1:12 PM
Timon Paßlick
0
Forgot to write that, thank you.
9th Aug 2017, 5:22 PM
Timon Paßlick