MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Three basic structures of the program

Source: Shangpin China | Type: website encyclopedia | Time: 2015-06-17
It has been proved theoretically that all computers Beijing website construction The program can be described by three basic control structures: sequence, selection and cycle.

1. Sequence structure

The sequence structure is used to represent a sequence of calculation operations that require sequential processing. The calculation process starts from the first operation described to the last operation of the sequence, and is executed sequentially, as shown in Figure 7-3. The sequence structure can also contain other control structures.

2. Select Structure

The selection structure represents the logical structure for selecting one of two or more processing branches. The basic selection structure is to specify a condition P, and then decide whether to execute calculation A or B according to whether the condition is true, that is, select one of the two branches to execute, as shown in Figure 7-4 (a). Calculation A or calculation B in the selection structure can also include order Select and cycle structure. The program language usually also provides a simplified selection structure, that is, a branch structure without calculating B, as shown in Figure 7-4 (b), and a multi branch selection structure.
 Select Structure

 

3. Cycle structure

The loop structure describes the process of repeated calculation. It usually consists of three parts: initialization part, the part that needs repeated calculation (called loop body), and the condition part for repeated calculation. The initialization part is sometimes not explicitly expressed. There are mainly two types of loop structure: while type loop structure and do=while type loop structure.

The logic meaning of while type structure is to judge condition P first, if it is true, execute loop body A, and then judge condition P, otherwise the control flow will exit the loop structure, as shown in Figure 7-5 (a).
 Cyclic structure


The logical meaning of the do while structure is to execute the loop body A first, and then judge condition P. If it is true, continue to execute the loop body A, and then judge condition P. Otherwise, the control flow will exit the loop structure, as shown in Figure 7-5 (b). An example of the calculation process represented by sequence, selection and cyclic structure is shown in Figure 7-6.
 Example of calculation process represented by sequence, selection and cyclic structure
Wherein, the calculation process shown in Figure 7-6 (a) means that shilling x obtains a value of 5, then y obtains a value of 7, finally the values of x and y are added and the results are stored in two; The calculation process shown in Figure 7-6 (b) means that first judge whether the value of x is greater than y, if so, let max obtain the value of r, otherwise let ma x obtain the value of y; The calculation process shown in Figure 7-6 (c) shows that shilling i obtains a value of 0, then judges whether the value of i is less than 10, if so, increases the value of i by 1, then judges the value of i to determine whether to continue to increase, and repeats the process until the value of i is equal to 10.
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]