First, if statement:
The first case of a 1.if statement:
An if (expression) statement
The second form of the 2.if statement:
if (expression) statement 1
Else Statement 2
The third form of the 3.if statement:
if (expression 1) Statement 1
else if (expression 2) Statement 2
else if (expression 3) statement 3
else if (expression 4) Statement 4
Else Statement 5
Second, switch statement:
switch (expression)
{
Case constant Expression 1:< statement sequence 1>
Case constant Expression 2:< statement sequence 2>
...//Other case branches
Case constant Expression n:< statement sequence n>
default:< Statement Sequence n+1>
}
The sequence of statements for adjacent case branches is stored next to each other, executes a sequence of statements for a case branch, does not automatically end the case statement, but executes subsequent branches. So, add the statement "break;" Used to jump out of a switch statement and go to execute a subsequent statement.
Three, Boolean type:
The Boolean type name is bool and has a value of only two: true and false.
True is a Boolean constant that represents the truth value; False constants represent false values.
C + + Fourth Lesson selection structure