Rules for compiling identifiers.

Programming in high-level languages


1.1. Alphabet and language dictionary

The program is formed from sentences consisting of lexemes and delimiters, which in turn are formed from a finite set of characters that form the Pascal language alphabet. This language consists of letters of the Latin alphabet (uppercase – A, B, C, D … X, Y, Z, lowercase – a, b, c … x, y, z), Arabic numerals (0, 1, 2, 3,4, 5, 6, 7,8,9) and special characters.

The use of lowercase letters is equivalent to the construction of the corresponding constructions from uppercase letters and is used for stylistic design of the program. In other words, case does not play a role when writing programs .

The delimiters are:


the end of the line,

; – semicolon (end of sentence)

a comment, which is text delimited on the left and right by curly braces.

Tokens include: reserved words, identifiers (standard and custom), special characters (simple and compound), labels.

Reserved words are an integral part of the language, have a fixed style and a specific meaning (for example, the VAR reserved word opens the variable declaration section).

Standard identifiers are used to define pre-reserved identifiers for predefined data types, constants, functions, and procedures (for example, the ABS standard function returns the modulus of its argument).

User identifiers are used to designate constants, variables, procedures, and functions. The user must choose an identifier name other than reserved words and standard identifiers.

Rules for compiling identifiers.

1. An identifier starts with a letter, or an underscore.

2. Contains only letters, numbers, or underscores.

3. There must be a separator between the two identifiers.

4. The maximum length is 127 characters. All characters are significant.

5. An identifier cannot repeat a reserved word.

6. If the user identifier repeats the standard one, then the action of the standard identifier is canceled.

Examples of user IDs: x, s, s23, asd_sd45.

Special characters:


+ “, ” “, ” * “, ” / “, ” = “, ” > “, ” < “, ” _ “, ” . ”, “ , ”, “ : ”, “ ; “”, ” {} “, ” [] “, ” () “, ” ^ “, ” “, ” $ “.


:= “, ” <> “, ” .. “, ” <= “, ” >= “.

Labels are used to identify statements in a program when following a GOTO statement. The rules for writing labels differ from the rules for compiling identifiers, as follows – a number can come first.

Label examples: B1oc_12, 67, M1, exit, 15GX.

1.2. Scalar, standard data types

Scalar data has a single value as its value. In this section, we will focus on the four most important, standard data types – INTEGER , REAL , BOOLEAN and CHAR .

Constants and variables

When solving any problem, data is required, on which actions are performed to obtain a result. Any given is either a constant or a variable.

Constants are data whose values are known in advance and do not change during program execution.

Variables are data that change their value as the program executes.

Type INTEGER (integer)

This type represents a set of integers in the range from -32768 to 32767. In the computer memory, two bytes (16 bits) are allocated for an integer. The largest value of the integer 32767 corresponds to the standard identifier MAXINT , and the smallest to the expression NOT ( MAXINT ) = – ( MAXINT +1), or the number -32768.

Operations performed on integers: “+” addition, “-” subtraction, “*” multiplication, DIV – integer division, MOD – integer division remainder, AND – arithmetic ‘AND’, OR – arithmetic ‘OR’, NOT – arithmetic negation, XOR – exclusive disjunction. Examples of the use of these operations are given in Table 1.

Table 1.

Operation Usage example Execution result
+ 5+3
5 – 3
* 5*3
DIV 14div4
MOD 14 mod 4
AND 11 and 5
OR 11 or 4
NOT not 8 -nine
XOR 11 xor 21

Either of these operations is feasible on two integers as long as the absolute value of the result does not exceed MAXINT (for multiplication). Otherwise, an overflow interrupt occurs.

For example: you want to evaluate the expression 1000 * 4000 div 2000 . Since multiplication and division operations have the same priority and are performed from left to right in the order of writing an arithmetic expression, an overflow abort will occur during multiplication. The way out of this situation is possible by changing the order of execution of multiplication and division operations, for which parentheses ==> 1000 * (4000 div 2000) are used.

The representation of integers in the hexadecimal number system is provided. The notation of such numbers is $X , where X is an integer constant, and the symbol $ is a sign. Examples: $57, $1FF. Recall that in the hexadecimal number system, the numbers 10, 11, 12, 13, 14 and 15 are replaced by the Latin letters A, B, C, D, E and F, respectively.

In addition to the INTEGER type, Pascal provides other integers.
data types BYTE, SHORTINT, WORD and LONGINT (Table 2). All these types are defined on the set of integers, are characterized by one set of arithmetic operations and differ in the range of values and the amount of memory they occupy.

table 2

Type name Length, bytes Number value range
BYTE 0..255
SHORTINT -128 .. 127
WORD 0..65535
INTEGER -32768 .. 32767
LONGINT -2147483648.. 2147483647

REAL type

A REAL number occupies three words (six bytes). When working with real numbers, you need to remember that there are an infinite number of numbers on any segment of the real axis. Since only six bytes of memory are allocated for encoding a real number, calculations are always performed with a finite precision, which depends on the format of the number.

A real number is written and stored in computer memory in the form , where m is the mantissa, B is the base of the representation of a floating point number, n is the exponent (integer). There are restrictions – M 1 < m < + M 2; – E 1< n < + E 2. In these expressions B , E and M are constants characterizing the representation of a number. Table 3 lists the values of these constants for the real data types used in Pascal.

Table 3

Type name Length, bytes Mantissa, number of significant digits Decimal order range
SINGLE 7..8 -45 .. 38
REAL 11..12 -39 .. 38
DOUBLE 15 .. 16 -324 .. 308
EXTENDED 19..20 -4951 .. 4932

So, for the REAL type, the base B is 10. The size of the mantissa is 11-12 decimal numbers. Decimal exponent range is [-39, +38]. Thus, on a segment of the axis of real numbers in a given range, only a finite number of values u200bu200bcan be encoded, and since there are an uncountable set of such numbers on the axis, an interval is chosen, a “discrete”, into which this range (segment) is divided. The number of such intervals is finite. Each discrete is assigned to the value of a real number. A finite set of representatives of real numbers defined in this way is called a continuum. The calculation results are rounded up to the numbers of this set, so it is necessary to talk about the accuracy of the calculations. The result is rounded up to the nearest real number greater than the given modulo. It should also be noted that these intervals are not equal. In accordance with the semi-logarithmic way of representing it, the intervals “stretch” with increasing order. The greatest accuracy of calculations is achieved in the central part of the range of the real number X (for example, in the region of 1.0Е+00, the calculation error is 0.000000000001), and the smallest is at its edges (for example, in the vicinity of the number 1.0Е+38, the calculation error is 10000000000000000000000000000000000000000000000).

There are two forms of displaying real numbers (Table 4): semi-logarithmic (floating point) and natural (fixed point).

Table 4. Correct representation of real numbers

floating point fixed point
0.000000E + 00 (normal form) 0.0
1.340000E + 02 134.0
-7611 .E – 02 -76.11
-98.3569E – 05 -0.000983569

Operations of addition (+), subtraction (-), multiplication (*) and division (/) are defined on real numbers. The exponentiation operation is not provided.

The use of the REAL type by a novice programmer often causes a number of
errors that lead to distortion of the result for the following reasons:

input errors – insufficient accuracy of the initial data when collecting, preparing and entering them into a computer;

representation errors are due to the limited accuracy of the internal representation of data in a particular computer used for calculations;

calculation errors arise due to the imperfection of the mathematical methods chosen to solve the problem. It is necessary to evaluate the error and keep it within the specified limits.

BOOLEAN type (boolean, logical)

A boolean type in Pascal is defined as an enumerated type containing only two values, which have identifiers FALSE (false) and TRUE (true). Elements of this type are assigned numbers: 0 for FALSE and 1 for TRUE . Therefore FALSE < TRUE .

In the computer memory, variables of this type occupy one byte. Above the data of this
type defined operations: disjunction ( ˅ ) OR, conjunction ( ˄ ) AND, exclusive OR ( ), negation ( ) NOT, as well as the relations <, >, <=, >=, <>, =. The results of performing logical operations on Boolean variables P and Q are shown in Table 5.

Table 5

P Q P ˄ Q P Q P Q P Q
False False False False False True True
True False False True True False True
False True False True True True False
True True True True False False False

It should be noted that data comparison operations of any type have a BOOLEAN result. For example, given variables named P, Q of type BOOLEAN and X, Y, Z of type REAL, with X = 5.8, Y = 8, and Z = 10.3, then the following statements are true:

Q := (X < Y) ˄ (Y <= Z) =>TRUE;

P:= X = Y => FALSE.

The boolean data type is most commonly used to control the order in which statements in a program are executed.

The language has an ODD ( X ) function, where X is an integer. If X is even, then ODD ( X ) is FALSE , if X is odd, then ODD ( X ) is TRUE .

The main relations of the algebra of logic:

1. R ˅ Q = Q ˅ R.

R ˄ Q = Q ˄ R.

2. (Р ˅ Q) ˅ R = Р ˅ (Q ˅ R).

(P ˄ Q) ˄ R = P ˄ (Q ˄ R).

3. (Р ˄ Q) ˅ R = (Р ˅ R) ˄ (Q ˅ R).

(Р ˅ Q) ˄ R = (Р ˄ R) ˅ (Q ˄ R).

4. (Р ˅ Q) = Q.

(P ˄ Q) = R Q.

When solving practical problems, a wide variety of conditions may arise, which should be written in the form of logical expressions using logical operations and relations. In this case, it is useful to keep in mind the following Boolean relations and equivalent transformations.

Equivalent transformations

X ≠ Y (X=Y)

X £ Y (X > Y) ˅ (X = Y)

X ³ Y (X < Y)

X > Y (X < Y) ˄ (X = Y)

Type CHAR (character, character)

This type specifies a finite ordered set of characters (literals) allowed in a particular implementation of the language. The computer uses the eight-bit ASCII code (American Standard Code for Information Interchange) for internal representation of characters, storage of character information on external media, and coding of character generators for displays and printers. The code capacity is 256 units.

The common part of the code table for all personal computers contains
characters having codes from 32 to 127, summarized in table 6.

Table 6

32 – ave. 48-0 64-@ 80 – P 96-‘ 112-p
33 – ! 49-l 65 – A 81-Q 97 – a 113-q
34-“ 50-2 66 – B 82-R 98-b 114-r
35-# 51-3 67 – C 83-S 99 – from 115-s
36-$ 52-4 68-D 84 – T 100-d 116-t
37% 53-5 69 – E 85-U 101 – e 117-u
38-& 54-6 70-F 86-V 102-f 118-v
39-‘ 55-7 71-G 87-W 103-g 119-w
40-( 56-8 72 – H 88-X 104-h 120-x
41-) 57-9 73-I 89-Y 105-i 121 – at
42-* 58-: 74-J 90-Z 106-j 122-z
43 – + 59 -; 75 – K 91-[ 107-k 123-{
44 – , 60-< 76-L 92- 108-l 124-|
45 – – 61-= 77 – M 93–] 109-m 125-}
46-. 62-> 78-N 94-^ 110-n 126-~
47 – / 63-? 79 – Oh 95-_ 111-o 127-

The first positions 0 – 31 are occupied by device control codes (monitor, printer, etc.) and may have different effects on different devices. For example, code 7 causes a beep when information is displayed on the display – WRITELN (‘Check the printer!’, CHR(7)) ; codes 13 and 10 for the display or printer move the cursor to the beginning of the current line and move to the next line. These codes can be used to display an informational message spanning multiple lines with a single output statement:

WRITELN(‘Warning!” + CHR(13) + CHR(10) + ‘Watch the screen.’).

The variable part of the code table contains the national alphabet, pseudographic characters and special non-standard characters. Codes 128 – 255, given in Table 7, reflect the modified GOST encoding for connecting Cyrillic.

Table 7

128 – A 144 – R 160 – a 176-░ 192 – └ 208-╨ 224 – p 240 – Yo
129-B 145 – C 161 – b 177-▒ 193-┴ 209-╤ 225 – from 241 – yo
130 – B 146 – T 162 – in 178-▓ 194-┬ 210 – ╥ 226 – t 242-Є
131 – G 147 – U 163 – g 179 – │ 195 – ├ 211-╙ 227 – at 243 – є
132 – D 148 – F 164 – d 180 – ┤ 196 – – 212 – ╘ 228 – f 244 – Ї
133 – E 149-X 165 – e 181-╡ 197 – ┼ 213 – ╒ 229 – x 245 – ї
134 – F 150 – C 166 – f 182 – ╢ 198-╞ 214 – ╓ 230 – c 246 –
135-3 151 – H 167 – h 183-╖ 199-╟ 215-╫ 231 – h 247 – ў
136 – And 152 – Sh 168 – and 184-╕ 200-╚ 216-╪ 232 – sh 248-º
137th 153 – Shch 169th 185 – ╣ 201-╔ 217 – ┘ 233 – w 249 – •
138 – K 154 – b 170 – to 186-║ 202 – ╩ 218 – ┌ 234 – b 250 – ·
139 – L 155 – S 171 – l 187 – ╗ 203-╦ 219-█ 235 – s 251-√
140 – M 156 – b 172 – m 188-╝ 204-╠ 220–▄ 236 – b 252 – No.
141 – H 157 – E 173 – n 189-╜ 205-═ 221-▌ 237 – e 253-
142 – Oh 158 – Yu 174 – about 190-╛ 206 – ╬ 222-▐ 238 – yu 254-■
143 – P 159 – I 175 – p 191 – ┐ 207-╧ 223-▀ 239 – I 255 – zb.

Note: in tables 6 and 7, the abbreviations (ex.) and (b.) mean space and backspace, respectively.

Values of constants and variables of type CHAR have one character from the allowed set, for example: ‘Z’, ‘j’, ‘2’, ‘*’, ‘Ц’, ‘д’, ‘г’. The second way to write a character in a program is to use the # prefix before the character number. Character examples: #90, #106, #50, #42, #150, #164.

Variables of this type are described as – VAR CHI, CH2:CHAR ;

The use of CHAR type variables in arithmetic expressions is prohibited. Only comparison operations can be applied to data of this type, and the result depends on the ordinal numbers of characters in the character encoding table.

For example: ‘B’ > ‘A’ => FALSE, ‘1’ <= '9' => TRUE.

The set of numbers and letters is not only ordered in accordance with the code of letters from 32 to 255, but also connected, the code of the next letter is greater than the code of the previous one by 1.

Thus ‘0’ < '1' < '2' < ... < '9'; 'A' < 'B' < 'C < 'D' < ... < 'Z'; 'a' < 'b' < 'c' < 'd' < ... < 'i'.

To work with letters, the functions CHR, ORD, PRED, SUCC are often used,
which are described in Table 10.

Example 1. Display characters on the monitor screen, the codes of which begin with 32
and end with 255.


FOR I:=32 TO 255 DO WRITELN(‘code =’, I:-3,’===>’, CHR(I))


Built-in Functions

The most common operations on scalar data types are implemented in Pascal using built-in (sometimes called standard) functions and procedures. The most well-known functions on variables of integer, real, logical and literal types are given in tables 8 – 11.

Table 8. Built-in arithmetic functions

Function Content
ABS(X) Modulus (absolute value) X, |X|
ARCTAN(X) Principal value of the arc tangent of X, ArctgX
COS(X) Cosine of X given in radians, Cos(X)
EXP(X) Exponential function of X, e x
FRAC(X) Fractional part of X, {X}
INT(X) The integer part of the number X in real form, ]X[
LN(X) Natural log of X, Ln(X)
SIN(X) Sin of X given in radians, Sin(X)
SQR(X) The square (second power) of the number X, i.e. x2
SQRT(X) The square root of X,
RANDOM(N) Uniformly distributed pseudo-random integer from 0 to N
RANDOM Uniformly distributed pseudo-random real number from 0 to 1
ROUND(X) Returns the value of X rounded to the nearest whole number
TRUNC(X) Returns the nearest integer less than or equal to X if X > 0 and greater than or equal to X if X < 0

Table 9 shows examples of calculations for the functions INT, ROUND, TRUNC, explaining the features of their use.

Table 9

Example number:
123.44 123.0
34.50 34.0
1.70 1.0
-25.14 -25.0 -25 -25
-10.70 -10.0 -eleven -ten
-0.41 0.0
-0.50 0.0 -one

Table 10. Built-in logical (boolean) functions

Function Content
ODD(N) N is an integer variable; the result is TRUE if N is an odd number, and FALSE if N is an even number
EOF(F) Returns TRUE if end of file F is reached, otherwise FALSE
EOLN(F) Returns TRUE if the end of the current line is reached while reading text file F , FALSE otherwise

Table 11. Built-in functions over enumerated data types

SUCC(s) SUCC(‘O’) ‘P’ Returns the value following S of the given enumerated type matches the type of argument S
SUCC(-90) -89
SUCC(‘a’) ‘b’
PRED(s) PRED(‘P’) ‘O’ Returns the value of the previous S in ascending order in the list matches the type of argument S
PRED(-90) -91
PRED(‘b’) ‘a’
ORD(s) ORD(‘W’) Returns the index number of the identifier S in the list INTEGER
CHR(s) CHR(87) ‘W’ Returns the character with the S code, if it exists CHAR
CHR(20l) ‘r’
CHR(53) ‘5’

1.4. Program structure

The programmer enters the text of the program, arbitrarily placing the lines on the screen. The indentation on the left is chosen by the programmer himself, so that the program is more readable. It is allowed to write several statements on one line. Long statements can be wrapped to the next line. A hyphen is allowed anywhere where a space can be made. The maximum string length must not exceed 127 characters. For reasons of clarity, ease of viewing and debugging the program, it is recommended to limit the line length to 80 characters. Programs have a rigid structure, described in Table 12.

Table 12. Structure of the program

Program fragment Content Note
header Program Optional
Section 0 USES, description of modules, libraries Sections of program block descriptions
Section I LABEL, label description
Section 2 CONST, description of constants
Section 3 TYPE, description of data types
Section 4 VAR, description of variables
Section 5 PROCEDURE, FUNCTION – description of procedures and functions used in the program
Section 6 BEGIN … END. – program body Executable statements section

The syntactic rules for constructing language sentences can be described in the following ways:

• outline (sentence or section format). In the educational process, this method was chosen, since it is most understandable to a novice programmer;

• syntax diagram. This method formalizes the syntax of the sentence in detail and is used by developers of translators from the Pascal language;

• generative rules of EXTENDED BACKUS-NAURA FORMS (EBNF). This is a very compact and at the same time visual way of writing language constructs. This method is used in articles and scientific developments. This course uses only five elements of RBNF (Table 13).

Table 13

Agreement Interpretation
Angle brackets < > Angle brackets enclose a syntax element that you must specify. The text inside the angle brackets characterizes the element, but does not describe the syntax of that element.
Square brackets [ ] Square brackets in syntactic constructions enclose one or more optional elements
Vertical bar | Separates two alternative elements of a syntactic construct, one of which must be chosen
Curly braces { } Curly braces enclose multiple elements separated by ‘|’. You need to choose one of them
Dots … An ellipsis indicates that you can repeat some element one or more times.

USES module description section

The section has the structure:


Module 1, Module 2, … Module N,

where the USES keyword is followed by a list that lists all the names of standard and user libraries (modules) whose procedures and functions are accessed in the program. If there are no such calls, then the USES section is not needed.



In this example, two standard libraries are CRT, GRAPH and two user libraries are HELP, MYLIB .

LABEL description section

The section has the structure:

LABEL Label 1, Label 2, Label N,

where the keyword LABEL is followed by a list that lists all the label names that occur in the program.


LABEL Ml, 12_BL, 9999;

Labels allow you to change the natural flow of program execution. A label is referenced using the GOTO


M27: X := A * B – C / 2;

The scope of a label is the block where it is described. Below is a diagram of the use of labels in the text of the program.
LABEL label 1, label 2;


label 1: ;

label 2: ;


CONST constant declaration section

A section exists if the algorithm uses at least one constant, that is, a value that does not change its value during program execution. An attempt to change the value of a constant in the program body will be detected at the translation stage.

In the Pascal standard, constants are defined in the following way:


= <3value 1>;

= <3value 2>;

= ;
Constant examples:


A = 15.7;

BXZ = ‘Series N123/5’;

MIN_IND = $15D;

С_10 = -0.57Е-6;

L125 = 695;


A constant can only have a predefined (standard) data type. The type is assigned to a constant by the appearance of the value, and in accordance with this type, memory is allocated to store the value of the constant.

As an extension of standard Pascal, it is allowed to use expressions composed of previously defined constants and some standard functions ( Abs, Chr, Hi, Length, Lo, Odd, Ord, Pred, Prt, Round, SizeOf, Succ, Swap, Trunc ). Examples of using constant expressions:


Min = 0;


Center = (Max-Min) div 2;

Beta = Chr(225);

NumChars = Ord(‘2’) – Ord(‘A’)+l;

Message = ‘out of memory’;

ErrStr = ‘Error:’ + Message + ‘.’;

Ln10 – 2.302585092994045884;

Ln10R = 1/Ln10;

Constant expressions are calculated by the compiler without executing the program at the stage of its creation.

TYPE description section

Standard data types ( REAL, INTEGER, BOOLEAN, CHAR ) do not require descriptions in this section. Descriptions require only user-generated types.

The concept of types is one of the basic concepts in the language. Each data has one and only one specific type associated with it.

A type is a set of values + a set of operations that can be performed on these values, that is, data manipulation rules. The use of types makes it possible to detect numerous errors associated with the incorrect use of values or operations even at the stage of translation without executing programs.

Pascal is said to be strongly typed, that is, the programmer must describe all objects by their types and use them according to the declared types. Programs become more reliable and of high quality. When compiling, the information is used to clarify the type of operation. So, the + sign for data of type REAL and INTEGER denotes the operation of addition, and for sets (type SET ) – union. The structure of the type description section is:


= ;

= ;

= ;

A type name is an identifier that can be used in other types that follow the type. The TYPE section is optional, as the type can also be declared in the VAR section. Examples of custom types descriptions:


DAY = 1..31; Year = 1900.. 2000; {interval type}

LatBukv = (‘A’, ‘C, ‘D’, ‘G, ‘H’); {enumerated type}

Matr = array[-1..12, ‘A’.. ‘F’] of real; {Regular type}

VAR variable declaration section

This is a required section. Any variable encountered in a program must be declared. There are no variables declared by default in the language. The main purpose of this section is to determine the number of variables in the program, what names (identifiers) they have, and what types of data are stored in these variables. Thus, the variable is a black box, and the type indicates what we can put in it.

The section structure looks like this:





The type of variables is a name (identifier) described in the TYPE section in case of an explicit type description, or the type description itself in case of its implicit specification. Variable declaration examples:


DAY= 1..31; Matr = ARRAY[1..5,1..8] OF INTEGER;


A, B: DAY; X, Y: matr; { explicit declaration of types }

YEAR: 1900.. 2000; LES: (LPT, PRN); { implicit type declaration }

A, B, CD, FER51: REAL; {description of variables stan-}

EQUAL: BOOLEAN; SH:CHAR; {standard types produced}

I, J, K: INTEGER; {only in the VAR section}

Procedures and functions description section

Standard procedures and functions whose names are included in the list of reserved words are not described in this section. Only procedures and functions defined by the user are subject to description.

PROCEDURE (); {procedure header}

{procedure body }



FUNCTION (): ; { title }

{function body}



The structure of procedures and functions is the same as that of the main program. The difference between the descriptions is that the identifiers of constants, variables, procedures and functions, described in the corresponding sections of the descriptions of user-defined procedures and functions, apply only to the blocks where they are described and to the blocks internal to them. They do not apply to external blocks, including the body of the main program.

Operator section

This is the main section, it is in it that, in accordance with the preliminary description of variables, constants, functions and procedures, actions are performed that allow obtaining the results for which the program was written.

The syntax of the statement section of the main program is:


{ Statements are executed}

{ strictly consecutive}

… {one by one.}



This is explanatory text that can be written anywhere in the program where a space is allowed. Comment text is limited: left – ‘{‘, right – ‘}’, and can contain any characters. The comment is ignored by the translator and has no effect on the program.

An example of using a comment:



{< Operator 3; >



Comment facilities are often used for debugging purposes. So in the example above, the statements – 3,…N, enclosed in curly braces, are temporarily not executed.

Punctuation rules

The main means of punctuation is the semicolon symbol – ‘ ; ‘.

1. The semicolon is not placed after the words LABEL, TYPE, CONST, VAR , but is placed
after each description of these sections.

2. A semicolon is not placed after BEGIN and before END , since these words are operator brackets.

3. A semicolon separates statements, and its absence will cause:

A := 333 {error – no ‘;’}

B := A/10;;;;; {four empty statements}

4. Possible situation:

END; should write END

END; ——————> END


5. It is allowed to write a label on an empty operator —

6. The semicolon is not placed after the WHILE, REPEAT, DO statements and before UNTIL .

7. In conditional statements ‘;’ not placed after THEN and before ELSE .


Solving a problem on a computer is a complex process during which the user has to perform a number of actions before he gets the result he is interested in.

The ideal model of the process of solving problems on a computer is shown in Table 14.

A detailed consideration of the stages of solving a problem on a computer is beyond the scope of this course. Let us recall only some essential definitions and concepts that will be used below.

Algorithmization is the process of designing an algorithm, that is, selecting a set of actions used in a mathematical method and reducing them to a set of actions that a computer will perform.

Table 14

Stages of problem solving Initial data, results
Solution start Goal formulation. Conceptual, meaningful statement of the problem
Problem statement Building a model
Formal mathematical formulation of the problem for a computer
Writing an algorithm in a programming language
The source text of the program in the algorithmic language. Program in computer codes
Program execution
Program execution results – numbers, charts, graphs
Analysis and use of program results
Conclusions based on the results of solving the original problem
End of decision

An algorithm is a set of precisely described actions that lead from the initial data to the desired result and satisfy the following properties:

• certainty – the algorithm must unambiguously, accurately and understandably specify the actions to be performed (for the same initial data, the same result must be obtained);

• discreteness – the algorithm must represent the action in the form of a sequence of constituent parts;

• performance – the algorithm should lead to the desired exact result in a finite time;

Be First to Comment

Leave a Reply

Your email address will not be published.