+ 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
3 Réponses
+ 1
Conditionals are evaluated to 1 if true, 0 if false.
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.
0
Forgot to write that, thank you.