if statement in c++

An if statement in C++ is used to make a decision in code. The syntax is as follows:

if (condition) {
  // code to be executed if the condition is true
}
  1. The keyword "if" is used to start the if statement.
  2. The condition is placed in parentheses after the "if" keyword. This condition is evaluated to be either true or false.
  3. If the condition is true, the code inside the curly braces immediately following the if statement is executed.