Selection Statements

They are two types of selection statements in C++. One selection statement is if/else statements. Another selection statement is the switch/case statement.

Syntax of a If/Else statement


if (condition1 == condition2)
{
//do something
} else {
//do something e;se
}

Syntax of a switch-case statement

switch (name of variable)
{
case 1: // do something break;
case 2: // do something else break;

}