Selection Statement – if Statement
Selection statements in C++ are used to control the flow of a program. They allow you to execute different blocks of code based on different conditions.
The two main selection statements in C++ are:
- if statement: The
ifstatement allows you to execute a block of code if a condition is true.
- switch statement: The
switchstatement allows you to select one of multiple blocks of code based on the value of an expression.
In this section will know more about if statement.