Current location - Education and Training Encyclopedia - Graduation thesis - How to write the pseudo-code of the algorithm in the paper with tex
How to write the pseudo-code of the algorithm in the paper with tex
Grammatical rules of pseudocode In pseudocode, each instruction takes up one line (except else if), and the instruction is not followed by any symbol (statements in Pascal and C should end with semicolons); The "indentation" in writing indicates the branch structure in the program. This indentation style also applies to if-then-else statements. Using indentation instead of the begin and end statements in traditional Pascal to represent the block structure of the program can greatly improve the clarity of the code. The statements of the same module are indented the same, and the statements of the child modules are indented relative to the statements of their parent modules; For example: line 65438+line 2

Subsidiary 1

Secondary line 2

Sub-branch 1

Secondary secondary line 2

Sub line 3line 3 and in Pascal, this relationship is expressed by the nesting of begin and end, line 1 line 2 begin.

Subsidiary 1

Secondary line 2

begin

Sub-branch 1

Secondary secondary line 2