ternary c++ ?: code example
Example 1: ternary operator in c++
(n1 > n2) ? n1 : n2;
OR
n1 > n2 ? n1 : n2;
Example 2: c++ ternary statement
x = condition ? expression1 : expression2
// Example:
double x = 1 > 0 ? 10 : 20; // put any value