The C++ conditional operator (also known as the ternary operator) provides a succinct way to select a simple operation or assignment value based on a condition, without expressing the selection with the more cumbersome if/else syntax. If the condition is true, the leftmost expression is evaluated, otherwise the rightmost. Example usage can be seen below.
int a(5), b(10); (a > b)? std::cout << a : std::cout << b; // operation int c = (a > b)? a : b; // assignment int d = (a > b)? ((a > 10)? 10 : a) : b; // nested