0
what do these operators mean?
I saw this code: int a; a=5>4?3>8?40:20:30; cout<<a; and the result was 20. i don't know the operators "?" ":", and what do they mean, and what they do in that contest. thanks.
2 ответов
+ 3
a>b?c:d means:
if(a > b)
{
return c;
}
else
{
return d;
}
5>4?9>8?40:20:30 means
if(5 >4)
{
if(9>8)
{
return 40;
}
else
{
return 20;
}
}
else
{
return 30;
}
0
it is a puzzle, so unclarity is the idea.