Qns: (x<y) ? y * 2: y * 3

#include <iostream>
using namespace std;

int main ()
{
int x = 1, y = -2;
x -= (x<y) ? y*2 : y*3;
cout << "x = " << x << ", y = " << y << endl;
return 0;
}

Can someone guide me what is the program asking? The result are x = 7, y = -2 after compiled.
(x<y) ? y * 2: y * 3

Is the same as:
1
2
3
4
if( x < y )
	x -= y*2;
else
	x -= y*3;
Thank you so much. :)
Topic archived. No new replies allowed.