In program development, the branch structure is used more frequently than the loop structure, with 10 branches and 4 loops.
Three scenarios of Program Development: Branch, loop, and branch
(1)
Three formats of if:
Int A = 10;
If (A> O)
{
Printf ("% d",)
}
When the condition expression is true or true, execute the statement in braces. Otherwise, execute the statement after if.
(2)
Char sex = 0;
Printf ("Enter your gender: m or F ");
Scanf ("% C", & sex );
If (sex = 'M '){
Printf ("male ");
} Else {
Printf ("female ");
}
(3)
If (){
.......
} Else if (){
.......
} Else if (){
......
} Else {
......
}
4 Relational operators <,>, >=, <=, = ,! =
5 logical operators & |! Note the short circuit of the expression.
6. Operator A> B? A: B
7 switch (){
Case __:
...........
Break;
..........
Default:
Break;
}
Select one more and use the switch... case statement. Pay attention to the break statement.
8. If the break statement is not met, the statement is executed in sequence. After the break statement is met, the switch is jumped out and the statement after braces is executed.
This article from "a long time back to one" blog, please be sure to keep this source http://lulun426.blog.51cto.com/9197884/1533984