Examples of flowchart symbols and flowcharts

Source: Internet
Author: User

Examples of common flowchart symbols and flowcharts are presented.
The algorithm for example 1-1 in this chapter is shown in Flowchart 1-2. The algorithm for example 1-2 in this chapter is shown in Flowchart 1-3.
In the flowchart, the process line on the left of the judging box indicates the process of judging the condition as true, the process line on the right indicates the process of the condition is false, and sometimes it is labeled "true", "false" or "T", "F" or "Y", "N" on the top of its left and right process lines respectively.


It is also stipulated that the process line is from bottom to top or right-to-left, must have an arrow, in addition, do not draw arrows, flow line direction always from top to bottom or from left to right.

2. Structured description of the algorithm
There are go to statements in early unstructured languages that allowprogramJump directly from one place to another.
The advantage of doing this is thatprogramThe design is very convenient and flexible, reducing the artificial complexity, but its shortcomings are very prominent, a lot of jump statements makeprogramThe process is very complex, difficult to understand and difficult to verifyprogramCorrectness, if wrong, it is very difficult to queue up. The confusion and complexity of this revolving flow chart is the software crisisprogramA vivid portrayal of the people's situation. and structuredprogramDesign, is to make this group mess clear.
After research, it is found that any complex algorithm can be composed of three basic structures of sequential structure, choice (branch) structure and cyclic structure, so when we construct an algorithm, we only take these three basic structures as "building units", abide by the specification of three basic structures, and the basic structure can be tied and Can be included, but not crossed, and not allowed to go directly from one structure to the inside of another. Just because the whole algorithm is composed of three basic structures, like building with modules, so the structure is clear, easy to verify the correctness, easy to correct, this method is a structured approach. Following this method ofprogramDesign, is the structure ofprogramDesign.
Accordingly, as long as three basic structures are specifiedDrawing of Flowchart, you can draw a flowchart of any algorithm.
(1) Sequential structure
The sequential structure is a simple linear structure in which the boxes are executed sequentially. The basic form of its flowchart is shown in 1-4, the statement
The order of execution is: A→b→c.
(2) Select (branch) structure
This structure is a given condition to be judged, the condition is true or false when the contents of different boxes are executed separately. There are two basic shapes, 1-5 a), b) shown. The execution sequence of Figure 1-5 a) is: Execute a When the condition is true, otherwise execute B; Figure 1-5 B) executes a sequence of: When a condition is true, do nothing.

(3) Cycle structure
There are two basic forms of the cyclic structure: the while loop and the Do-while loop.
A. While-loop
As shown in 1-6.
Its execution sequence is: When the condition is true, repeatedly executes a, once the condition is false, jumps out of the loop, executes the loop tight statement.
B. Do-while type cycle
As shown in 1-7.

The execution sequence is: First execute a, then judge the condition, the condition is true, always loop to execute a, once the condition is false, end the loop, execute the next statement after Loop tight.
In Figure 1-6, figure 1-7, A is called the loop body, the condition is called the cyclic control condition. It is important to note that:
1) in the loop body, it is necessary to modify the value of the condition to judge, so that after a finite cycle, the cycle must be able to
At the end, I = I-1 in 1-3.
2) The loop body may not be executed once in a loop, and the loop body is executed at least once for the type loop.
3) until the type cycle can be easily converted into a type of cycle, and when the loop does not necessarily translate into a loop.
For example, figure 1-7 can be converted to figure 1-8.

Seven, using the N-S diagram to describe the algorithm
The N-S diagram is another algorithm representation, which is by the Americans I. Nassi and B.shneiderman together, according to the following:
Since any algorithm is composed of the three structures described earlier, the process lines between the basic structures are redundant, so the N-S diagram is also a structured description method of the algorithm.
In the N-S diagram, an algorithm is a large rectangular box containing a number of basic boxes, three basic structure of the N-S diagram is described as follows:
1. Sequential structure
1-9, the execution sequence is preceded by a B.
2. Select structure
The n-S diagram corresponding to Figure 1-5 is figure 1-1 0. Figure 1-10 A) executes a when the condition is true, and the condition is false when B is executed. Fig. 1-1 0
b when the condition is true, A is performed, and nothing is done when it is false.

3. Cyclic structure
1) The While loop is shown in the N-S figure 1-11, the condition is true when the loop body A is executed, until the condition is false to jump out of the loop.
2) n-S diagram of the do-while-type cycle 1-1 2, the loop body A is continuously executed until the condition is false to jump out of the loop.
This chapter example 1-1 of the N-S Figure 1-1 3, example 1-2 of the N-S figure 1-1 4. It should be said that the N-S diagram is more straightforward and relatively concise than the flowchart.

Eight, using pad diagram to describe the algorithm
Pad (problem analysis Diagram), is a software development in recent years, is widely used in the graphical representation of an algorithm, compared with the above flow chart, n-S diagram, the flow chart, n-S diagram is a top-down sequence description, and pad map in addition to the top-down, There is a left-to-right expansion, so, if the flowchart, N-S diagram is a one-dimensional algorithm description, then the pad is two-dimensional, it can show the hierarchical structure of the algorithm, more intuitive and understandable.
Here are some basic forms of the pad diagram:
1. Sequential structure:
shown in 1-1 5.
2. Select structure
(1) Single branch selection, the condition is true to execute a,1-16 a).
(2) Two branch selection, 1-16 b), the condition is true to execute a, B for false execution.
(3) Multi-branch selection, 1-16 c), when I = I1 executes a,i= I2 when executing b,i = I3 when executing c,i = I4 when executing d.

3. Cyclic structure
Shown in 1-1 7. Figure 1-17 A) is a while loop, and figure 1-17 B) is a do-while loop.

This chapter is Example 1. PA d in Fig. 1, Figure 1-1 8, example 1-2, figure 1-1 9

Examples of flowchart symbols and flowcharts

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.