First of all, we talk about theoretical knowledge, in programming there are three kinds of structure, respectively, the sequence structure, the conditional structure, the loop structure, if the flow chart to express is:
So in C language, how to use these three kinds of structure flexibly? This requires the use of a control statement .
The conditional statement is one of the control statements.
C language Conditional statements Generally, there are three:if statements,If......else statements, and switch statements
Let's take a look at these three statements separately
One, if statement
(Use an If statement to implement a branch of the above conditional structure)
Second, If......else statement
(Implement the above conditional structure with IF......ELSE statement)
Third, switch statement
(now use the switch statement to implement an input number to output its corresponding note)
Summary: The IF statement only determines the condition of yes;
The If......else statement not only determines the condition of Yes, but also determines the no condition.
The switch statement is judged by a specific situation and its exceptional condition.
When writing a C program, it is the case that the appropriate conditional statement has been selected to achieve the designed effect.
Number of children · C Language-Conditional statements