11th May 2018, 9:19 PM
Sebist Zdandler
3 odpowiedzi
0
the expression x?y:z returns y if x is true, and z if x is false. (-a == 1) is false so we have a +=4; which is equivalent to a=a+4
11th May 2018, 9:39 PM
ifl
ifl - avatar
0
//initialize a to 3 and b to 4 int a =3, b=4; //recalculate a as follow: // if( a==-1 ){ // a=a-3 // } // else { // a = a+4 // } a+=(-a==1?-3:4); //Now a is 7 //Print a cout<<a;
11th May 2018, 9:33 PM
ifl
ifl - avatar
0
Thank you!
11th May 2018, 9:42 PM
Sebist Zdandler