search
HomeCommon ProblemWhat are the three basic structures of structured programs?

What are the three basic structures of structured programs?

Dec 02, 2020 am 10:45 AM
Loop structurestructured programSelect structuresequential structure

The three basic structures are: 1. Sequential structure, each operation in the program is executed in the order in which they appear; 2. Selection structure, the processing steps of the program branch, and they need to be based on certain conditions. Select one of the branches to execute; 3. Loop structure, the program repeatedly performs one or more operations until a certain condition is false (or true) before the loop can be terminated.

What are the three basic structures of structured programs?

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.

Structured programming adopts a top-down, step-by-step refinement design method. Each module is connected through a "sequence, selection, loop" control structure, and has only one entrance and one exit.

The principle of structured programming can be expressed as: program = (algorithm) (data structure).

The algorithm is an independent whole, and the data structure (including data type and data) is also an independent whole. The two are designed separately, focusing on algorithms (functions or processes).

With the development of computer technology, software engineers are paying more and more attention to the expression of the overall relationship of the system, so data model technology has emerged (treating data structures and algorithms as an independent functional module), which is oriented to The prototype of object programming.

There are three basic structures of structured programs: sequential structure, selection structure and loop structure.

What are the three basic structures of structured programs?

1. Sequential structure

The sequential structure indicates that the operations in the program are executed in the order in which they appear. The characteristics of this structure are: the program starts from the entry point a and performs all operations in sequence until the exit point b, so it is called a sequential structure.

2. 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.

3. 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.

The above is the detailed content of What are the three basic structures of structured programs?. 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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version