Number of children · C Language-Conditional statements

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.