What is a Flow Chart?
A program flowchart, also called a program block diagram, is a graphical representation that describes the specific steps of a program's operation with uniformly prescribed standard symbols. The design of the block diagram is based on the processing flow chart, through the detailed analysis of input and output data and processing process, the main operating steps and content of the computer are identified. The block diagram is the most basic basis for programming, so its quality is directly related to the quality of programming. [1]
- program
- Any complex algorithm can be composed of three basic structures: sequential structure, selection (branch) structure and cyclic structure. Therefore, when constructing an algorithm, only these three basic structures are used as "building units". This kind of basic structure specification can be juxtaposed and mutually contained, but it is not allowed to intersect, and it is not allowed to directly transfer from one structure to another. Because the entire algorithm is composed of three basic structures, just like modules, the structure is clear, easy to verify correctness, and easy to correct. This method is a structured method. Programming that follows this approach is structured programming. Correspondingly, as long as the drawing method of the flowchart of the three basic structures is specified, the flowchart of any algorithm can be drawn. [4]
- A program flowchart is a description of a method, idea, or algorithm for solving a problem.
- 1.
- Problem of calculating rectangular area: [3] [1]
- It can be divided into the following steps:
- (1) Set two variables num1 and num2, receive the length and width input by the user, and store them in two variables num1 and num2
- (2) Determine whether num1 and num2 are greater than 0. If it is greater than 0, continue to the next step, otherwise the user is prompted to enter an incorrect length and width, and the algorithm ends;
- (3) Calculate the product of num1 and num2, and store the result of the product in the result variable;
- (4) Display the value of the result variable to the screen.
- The calculation flowchart is:
#include <stdio.h> main () { int num1, num2, mj; printf ("Please enter the length and width of the rectangle"); scanf ("% d% d", & num1, & num2); mj = num1 * num2; printf ("The area of this rectangle =% d", mj); }