cpp if ? : code example
Example 1: c++ if example
if (20 > 18) {
cout << "20 is greater than 18";
}
Example 2: c++ if else if
if(boolean_expression 1) {
// Executes when the boolean expression 1 is true
} else if( boolean_expression 2) {
// Executes when the boolean expression 2 is true
} else if( boolean_expression 3) {
// Executes when the boolean expression 3 is true
} else {
// executes when the none of the above condition is true.
}