Program Structure

Program structure: sequential structure, selection structure, a cyclic structure

1, the structure of the order

  Program line by line from top to bottom, a statement after the execution proceed to the next statement, until the end of the program

2, selection (branch) structures

  According to the conditions of the establishment or not, to determine a structure in which the statement is to be performed

  (1) selecting a first set of configuration: if, if ... else, if ... else if ... else

  (2) a second structure selected from the group: For multi-condition determination, using if ... else if ... else boolean condition is determined, and if it is a multi-value determination, the switch statement can be complete

3, the cyclic structure

  The determination whether or not the number of execution condition establishment is determined in the program section, and this is called the cycle master program section

  Mainly refers to a cyclic code may be repeatedly performed a plurality of times, the operating cycle is divided into two: while loop and for loop

  (1) while the cycle is divided into two forms: do ... while and while

  (2) for circulation, its greatest feature is clearly aware of the number of cycles

    Benefits for loop that defines the initial value of the cycle, the cycle determination, the loop condition can be further modified single statement completed

Guess you like

Origin www.cnblogs.com/cyx3217/p/11675778.html