Home  >  Article  >  What should be the module that meets the requirements of structured programming?

What should be the module that meets the requirements of structured programming?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-01 15:11:132293browse

Modules that meet the requirements of structured programming should use three basic control structures: sequence, selection and repetition (loop) to express the control logic of the program. Structured programming is a subset of procedural programming that uses logical structures in written programs to make understanding and modification more efficient and easier.

What should be the module that meets the requirements of structured programming?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

Modules that meet the requirements of structured programming should use three basic control structures: sequence, selection and repetition (loop) to express the control logic of the program.

Structured programming is the basic principle for detailed design focusing on module function and process design. Structured programming is a subset of procedural programming that uses logical structures in written programs to make understanding and modification more efficient and easier.

Sequential structure

The sequential structure indicates that the operations in the program are executed in the order in which they appear.

Selection structure

The selection structure indicates that there are branches in the processing steps of the program, and it needs to select one of the branches for execution based on a specific condition. There are three types of selection structures: single selection, double selection and multiple selection.

Loop structure

The loop structure means that the program repeatedly performs one or more operations until a certain condition is false (or true) before the loop can be terminated. The most important thing in a loop structure is: under what circumstances is the loop executed? What operations need to be performed in a loop? There are two basic forms of loop structures: when-type loops and until-type loops.

When-type loop: It means to judge the condition first, execute the loop body when the given condition is met, and the process will automatically return to the loop entrance at the loop terminal; if the condition is not met, exit the loop body and directly reach the process exit. Because it is "execute the loop when the condition is met", that is, judge first and then execute, it is called a when loop.

Until loop: It means that the loop body is executed directly from the entrance of the structure, and the condition is judged at the loop terminal. If the condition is not met, return to the entrance to continue executing the loop body until the condition is true before exiting the loop and reaching the process. At the exit, it is executed first and judged later. Because it is "until the condition is true", it is called a until loop.

For more computer-related knowledge, please visit the FAQ column!

The above is the detailed content of What should be the module that meets the requirements of structured programming?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn