如何分解下面的语句:
int max = i > j
? i > k ? i : k
: j > k ? j : k;
与
int max = i;
if (j > max)
max = j;
if (k > max)
max = k;
等价?
cout << (i < j ? i : j); // ok: prints larger of i and j
cout << (i < j) ? i : j; // prints 1 or 0!
cout << i < j ? i : j; // error: compares cout to int
cout << (i < j); // prints 1 or 0
cout ? i : j; // test cout and then evaluate i or j
// depending on whether cout evaluates to true or false
以上又如何来解?