Structured data types. Basic designs of algorithms. Data Types: Simple and structured than simple data types differ from structured

Simple data types

Data types

general characteristics relational data model

The basics of the relational data model were first set out in the article E.Kodda in 1970. This work served as an incentive for a large number of articles and books in which the relational model was further developed. The most common interpretation of the relational data model belongs to K.Date. According to Date, the relational model consists of three parts:

  • Structural part.
  • Holistic part.
  • Manipulation part.

Structural part Describes which objects are considered by the relational model. It is postulated that the only structure of the data used in the relational model is normalized N-arched relationships.

Holistic part Describes the limitations of the special type that must be performed for any relationship in any relational databases. it integrity of entities and the integrity of external keys .

Manipulating part describes two equivalent methods for manipulating relational data - relational algebra and relational calculus .

This chapter discusses the structural part of the relational model.

Any data used in programming has its own data types.

Important! The relational model requires the types of data used simple.

To clarify this approval, consider which data types are usually considered in programming. As a rule, data types are divided into three groups:

  • Simple data types.
  • Structured data types.
  • Reference data types.

Simple, or Atomic, Data Types Do not possess the internal structure. This type of data is called scalari. . Simple data types include the following types:

  • Logical.
  • String.
  • Numerical.

Various programming languages \u200b\u200bcan expand and specify this list by adding such types as:

  • Whole.
  • Real.
  • Date.
  • Time.
  • Monetary.
  • Enumerable.
  • Interval.
  • Etc.…

Of course, the concept of atomicity is quite relative. Thus, the string data type can be viewed as a one-dimensional array of characters, and a whole data type - as a set of bits. It is only important that when moving to such a low level is lost. semantics (meaning) of data . If the string expresses, for example, the surname of the employee, decompose into an array of characters, then the meaning of such a line is lost as a whole.

Structured data types Designed for the task complex structures data. Structured data types are designed from the components of the elements called the components, which, in turn, can have a structure. The following types of data can be brought as structured data types:

  • Arrays
  • Entries (Structures)

From a mathematical point of view, an array is a function with the final area of \u200b\u200bdefinition. For example, consider the final set of natural numbers.

called multiple indexes. Display

from the set to a plurality of real numbers, a one-dimensional material array sets. The value of this function for a certain value of the index is called an array element corresponding to. Similarly, you can set multidimensional arrays.

Recording (or structure) is a tuple from some decartular product of sets. Indeed, the record is a named ordered set of elements, each of which belongs to the type. So recording There is a set of set . Announced new types of records based on already available types, the user can design an arbitrarily complex data types.

Common for structured data types is that they have an internal structureused at the same level of abstractionthat the data types themselves.

Let us explain it as follows. When working with arrays or recordings, you can manipulate an array or recording and both with one (create, delete, copy entire arrays or records) and elementary. For structured data types, there are special features - types designers that allow creating arrays or recordings from simpler types of elements.

Working with simple data types, for example, with numeric, we manipulate them as indivisible whole objects. To "see" that the numeric data type is actually folded (it is a set of bits), you need to go to a lower level of abstraction. At the level software code It will look like assembly inserts in the language code high level or the use of special batch operations.

algorithm Discrete programming

Real data that processes the program is integer and real numbers, Symbols and logical values. These simple data types are called basic. All data processed by the computer are stored in the computer's memory cells, each of which has its own address. In order not to ensure that any data will be recorded at any address, the concept of a variable is used in programming languages. , allowing you to distract from the address of the memory cell and access it using the name ( identifier).

Variable - There is a named object (memory cell), which can change its value. Name The variable indicates to value, And the way it is stored and the address remains hidden from the programmer. In addition to the name and value, the variable has a type, Defining which information is in memory. A type The variable sets:

  • * used method for recording information in the memory cell;
  • * Required memory for storage.

The amount of memory for each type is determined in such a way that any value from the permissible range of values \u200b\u200bcan be placed in it. this type. For example, the type "byte" can take values \u200b\u200bfrom 0 to 255, which binary code (255 \u003d 11111111 2) corresponds to a memory cell with a length of 8 bits (or 1 byte).

In the algorithms described above, all data is stored as variables. For example, the instruction "Enter two numbers but, b » Indicates the administration of the values \u200b\u200bof two variables by the user, and the instruction "K \u003d K + 1" means an increase in the value of the variable to one.

If the variables are present in the program, throughout its time, they are called static. Variables created and destroyed at different stages of the program are called dynamic.

All other data in the program, the values \u200b\u200bof which do not change throughout its operation, are called constanta or constant. Constants, as well as variables, have type. They can be specified explicitly, for example, in the instructions "K \u003d K + 1" 1 there is a constant, or for convenience, denote by identifiers: pI = 3,1415926536. Only value pI It is impossible to change, as it is a constant, not a variable.

To increase productivity and quality, it is necessary to have data as close as possible to real analogues. The data type that allows you to store together under one name several variables, called structured. Each programming language has its own structured types. Consider the structure that combines the elements of one type of data - an array .

An array An ordered set of one-type values \u200b\u200bthat having a common name, the elements of which are addressed (differs) by sequence numbers (indexes) are called. As an illustration, a wardrobe containing a plurality of numbered boxes can be submitted (a totality - "box number 1", "box number 2", "box number 3", etc.; "Box" is the common name of all its elements). Access to the contents of a specific box (an element of the array) is carried out after selecting a box at its number (index). The elements of the array in the memory of the computer are stored in the neighborhood, single elements of the simple type of such location in memory do not assume. Arrays differ in the number of indices that determine their elements.

One-dimensional array (Cabinet boxes in one row) assumes the presence of only one index from each element. Examples of one-dimensional arrays are arithmetic and geometric sequences that determine the final rows of numbers. The number of elements of the array is called dimension. When determining the one-dimensional array, its dimension is written in parentheses, next to its name. For example, if it is said: "An array A (10) is set, it means that elements are given: but r but 2 ,…, a. ig. . Consider the algorithms for processing elements of one-dimensional arrays.

Entering the elements of a one-dimensional array is carried out alternately, in the order required to solve a specific task. Usually, when you need to enter the entire array, the procedure for entering the elements is not important, and the elements are entered in ascending order of their indices.

The data type determines the set of permissible values \u200b\u200band many permissible operations.

Simple types.

Simple types are divided into ordinal and real.

1. Ordinary types , In turn, there are:

a) integers

In Pascal, 5 integer types are defined, which are determined depending on the sign and the values \u200b\u200bthat the variable will receive.

Title type

Length (in bytes)

Range of values

32 768...+32 767

2 147 483 648...+2 147 483 647

b) logical

The name of this type of Boolean. The logical type values \u200b\u200bcan be one of the logical constants: true (truth) or false (lies).

c) symbol

The name of this type CHAR is ranked 1 byte. The symbol type value is the set of all PC characters. Each character is assigned an integer in the range of 0 ... 255. This number serves as the code of the internal representation of the symbol.

2. Real Types .

In contrast to the ordinal types, the values \u200b\u200bof which are always compared with a number of integers and, therefore, are absolutely precisely precisely precisely, the values \u200b\u200bof the real types determine an arbitrary number only with some finite accuracy depending on the internal format of the real number.

Length of numeric data type, byte

Name of the numerical data type

Number of values \u200b\u200bof numerical data type

Decimal-type decimal type range

2*1063 +1..+2*1063 -1

Striking types

Structured data types are determined by an ordered set of scalar variables and are characterized by the type of their components.

Structured data types Unlike simple sets of sets of complex values \u200b\u200bwith one common name. It can be said that structural types determine some method of forming new types of existing ones.

There are several structuring methods. According to the method of organization and type of components in complex data types, the following varieties are isolated: Regular type (arrays); Combined type (record); File type (files); multiple type (sets); string type (string); In Turbo Language, Pascal version 6.0 and older, an object type (objects) is entered.

Unlike simple data types, the structure of the structured type is characterized by the plurality of these type of elements, i.e. A variable or constant of a structured type always has several components. Each component in turn can belong to the structured type, i.e. Possible types of types.

1. Arrays

Arrays in Turbo Pascal are largely similar to similar data types in other programming languages. A distinctive feature of arrays is that all their components are the data of the same type (possibly structured). These components can be easily streamlined and access to any of them by simply indicating the sequence number.

The array description is set as follows:

<имя типа> \u003d Array [<сп.инд.типов>] OF.<тип>

Here<имя типа> - the correct identifier;

Array, of - reserved words (array, from);

<сп.инд.типов> - a list of one or more index types separated by commas; Square brackets framing the list - the requirement of syntax;

<тип> - Any type of turbo Pascal.

As index types in Turbo Pascal, any sequence types can be used, except Longint and type-range types with a Longint base type.

The depth of the structured type of structured types in general, and therefore arrays - arbitrary, therefore the number of items in the type of type indexes list (the dimension of the array) is not limited, but the total length of the internal representation of any array cannot be more than 65520 bytes.

2. Entries

Recording is a data structure consisting of a fixed number of components called recording fields. Unlike the array, the components (fields) of the entry can be of different types. To refer to a particular record component, the fields are called.

Recording type ad structure:

< nametype\u003e \u003d Record.< sP.. fields\u003e End.

Here<имя типа> - the correct identifier;

Record, End - reserved words (entry, end);

<сп.полей> - list of fields; It is a sequence of recording partitions, between which the point is plated.

3. Set

Sets are a set of similar logical connected to each other of objects. The nature of the links between objects is only meant by the programmer and the turbo Pascal is not controlled. The number of elements included in the set can vary in the range from 0 to 256 (a set that does not contain elements is called empty). The change of the number of its elements of the set differ from arrays and records.

Two sets are considered equivalent if and only if all of their elements are the same, and the order of the elements of the set is indifferent. If all elements of one set are also included in the other, they talk about the inclusion of the first set in second.

Description of the type of set is:

< nametype\u003e \u003d Set of< baz. a type>

Here<имя типа> - the correct indicator;

SET, Of - reserved words (set, out);

<баз.тип> - The basic type of set elements, which can be used any sequence type, except Word, Integer and Longint.

To specify a set, the so-called set constructor is used: a list of specifications of the elements of the set separated from each other with commas; The list is framed by square brackets. The specifications of the elements may be a constant or expressions of the basic type, as well as the type-range of the same basic type.

4. Files

Under the file is understood either named area external memory PC, or a logical device - a potential source or receiver of information.

Any file has three characteristic features.

    he has a name that allows the program to work simultaneously with multiple files.

    it contains the components of the same type. The component type can be any type of Turbo Pascal, except for files. In other words, it is impossible to create a "file file".

    length again created file It is not stipulated in any way when it is declared and is limited to the container of external memory devices.

File type or variable file type You can set one of the three ways:

< name\u003e \u003d File of< a type>;

< name\u003e \u003d Text;

<имя> \u003d File;

Here<имя> - File type name (correct indicator);

File, of - reserved words (file, out);

Text - the name of the standard type of text files;

<тип> - Any type of turbo Pascal, except for files.

Depending on the declaration method, you can select three types of files:

· Typed files (specified by the offer File of ...);

· text files (are determined by TEXT type);

· Non-type files (are determined by the File type).

On the conversion of numeric data types of Pascal

In Pascal, implicit (automatic) transformations of numeric data types are almost impossible. Exception is made only for the type of Integer, which is allowed to be used in Real expressions. For example, if the variables are described as follows:

VAR X: Integer; Y: Real;

then operator

it will be syntactically correct, although it is an integer expression to the right of the assignment sign, and the left is a real variable, the compiler will make the conversion of numeric data types automatically. The opposite conversion automatically type REAL in the Integer type is impossible. Recall how the amount of byte is allocated to the integer and real variables: the integer type of INTEGER data is allocated 2 memory bytes, and under Real - 6 bytes. To convert Real to Integer, there are two built-in functions: Round (x) rounds the real x to the nearest whole, trunc (x) trunks the real number by discarding the fractional part.

Simple types include sequence, real types and type date-time.

The ordinal types are characterized by the fact that each of them has a finite number of possible values. These values \u200b\u200bcan be ordered in a certain way (from here - the name of the types) and, therefore, with each of them you can compare some integer - the sequence number of the value.

Real types, strictly speaking, also have a finite number of values, which is determined by the format of the internal representation of the real number. However, the number of possible values \u200b\u200bof real types is so large that it is not possible to compare with each of them (its number) is possible.

Type Date-Time is designed to store dates and time. In fact, for these purposes, it uses the real format.

Ordinal types

The ordinal types are related (see Fig. 1.1) integers, logical, symbol, listed and type-range. To any of them, the ORD (X) function is applicable, which returns the sequence number of expression X.

Fig. 1.1

For integer types, the ORD (X) function returns the value of x, i.e. ord (x) \u003d x for x belonging to any whole type. The use of ORD (X) to the logical, symbolic and listed type gives a positive integer in the range from 0 to 1 (logical type), from 0 to 255 (symbol), from 0 to 65535 (listed). Type-range saves all the properties of the basic sequence type, so the result of using the ORD (x) function to it depends on the properties of this type.

To sequence types, you can also use functions:

pred (x) - Returns the previous value of the sequence type (a value that corresponds to the order of ORD (x) -1, i.e. ORD (PRED (X)) \u003d ORD (X) - 1;

sUCC (x) - returns the next value of the sequence type, which corresponds to the order number ORD (x) +1, i.e. ORD (SUCC (X)) \u003d ORD (x) + 1.

For example, if a variable is defined in the program

the pred (C) function will return the character "4", and the SUCC (C) function is the "6" symbol.

If you imagine any sequence type as an ordered set of values \u200b\u200bincreasing from left to right and occupy a certain segment on the numeric axis, then the PRED (X) function is not defined for the left, A SUCC (x) - for the right end of this segment.

Whole types. The range of possible values \u200b\u200bof the entire types depends on their internal representation, which can occupy one, two, four or eight bytes. In tab. 1.1 The names of the entire types are given, the length of their internal representation in bytes and the range of possible values.

Table 1.1 - Whole types

Name

Length, byte

Range of values

0. .. 2 147 483 647

32 768...+32 767

2 147 483 648...+2 147 483 647

9*1018...+9*1018

0. . .4 294 967 295

Types of Longword and Int64 are first entered in version 4, and SMallINT and Cardinal types are missing in Delphi 1. Integer type for this version takes 2 bytes and has a range of values \u200b\u200bfrom -32768 to +32767, i.e. coincides with SMALLINT.

When using procedures and functions with integer parameters, you should be guided by the "nesterness" of the types, i.e. Wherever Word can be used is allowed by the use of Byte (but not vice versa), in Longint "enters" Smallint, which, in turn, includes shortint.

The list of procedures and functions applicable to integer types is given in Table. 1.2. Letters B, S, W, I, L are indicated by the expressions of the BYTE type, shortiness, word, integer and longint type, the type of BYTE, SHORTINT, WORD, INTEGER and LONGINT,

x - expression of any of these types; The letters VB, VS, VW, VI, VL, VX indicate the variables of the respective types. In square brackets, the optional parameter is specified.

Table 1.2 - Standard procedures and functions applicable to integer types

Appeal

Type of result

Act

Returns the X Module

Returns a symbol in its code

Reduces the value of VX to I, and in the absence of i - on 1

Increases the value of VX to I, and in the absence of i-it 1

Returns the Senior Argument Bow

Returns the third byte

Returns the younger byte argument

Returns True if an argument is an odd number

Like the parameter

Returns a pseudo-random number, uniformly distributed in the range 0 ... (W-L)

Returns the square of the argument

Changes in places bytes in the word

Under actions with integers, the type of result will correspond to the type of operands, and if the operands refer to various integer types - total typewhich includes both operands. For example, when acting with Shortint and Word, the general will be type Integer. IN standard setting The Delphi compiler does not produce a code that controls the possible check of the value from the valid range, which can lead to misunderstandings.

Logic types. The logical includes types Boolean, Bytebool, Bool, WordBool and Longbool. In the standard Pascal, only the type of Boolean is defined, the remaining logic types are entered in Object Pascal for compatibility with Windows: BOOLEAN and BYTEBOOL Types occupy one byte each, bool and wordbool - 2 bytes, longbool - 4 bytes. The values \u200b\u200bof the logical type can be one of the pre-declared FALSE constants (lies) or True (Truth).

Since the logical type refers to the sequence types, it can be used in the current type cycle operator. In Delphi 32 for boolean value

ORD (TRUE) \u003d +1, while for other types (bool, wordbool, etc.)

ORD (TRUE) \u003d -1, so this kind of operators should be used with caution! For example, for the version of Delphi 6 executable statement ShowMessage ("---") in the following cycle for will not be fulfilled:

for L: \u003d False To True Do

ShowMessage ("-);

If you replace the type of cycle parameter L in the previous example on Boolean, the cycle will work and the message will double on the screen. [For Delphi version 1 and 2 ORD (TRUE) \u003d + 1 for any logical type.]

Symbol type. Symbolic type values \u200b\u200bare the set of all PC characters. Each character is attributed to an integer in the range of 0 ... 255. This number serves as the code of the internal representation of the symbol, it returns the ORD function.

For an encoding in Windows, an ANSI code is used (named American National Standard Institute - the American Institute for Standardization, which suggested this code). The first half of the PC characters with codes 0 ... 127 corresponds to Table 1.3. The second half of the symbols with codes 128 ... 255 is changing for various fonts. Standard Windows Fonts Arial Cyr, Courier New Cyr and Times New Roman to represent Cyrillic characters (without letters "E" and "E") use the last 64 code (from 192 to 256): "A" ... "I" are encoded values \u200b\u200b192..223, "A" ... "I" - 224 ... 255. The characters "E" and "E" have, respectively, codes 168 and 184.

Table 1.3 - symbol encoding in accordance with the ANSI standard

Symbols with codes 0 ... 31 belong to service codes. If these codes are used in the symbolic text of the program, they are considered spaces.

CHAR type applications are applicable relationships, as well as embedded functions:

SHAR (B) - the function of type char; converts the expression into the BYTE type into the symbol and returns it to its value;

Upcase (CH) - CHAR type function; Returns a capital letter if the CH is a lowercase Latin letter, otherwise the symbol itself returns the source character for Cyrillic).

Listed type. The type of type is set by the enumeration of the values \u200b\u200bthat it can receive. Each value is referred to as a certain identifier and is located in the list framed by round brackets, for example:

colors \u003d (Red, White, Blue);

Application of listed types makes programs visually.

The correspondence between the values \u200b\u200bof the type of type and the sequence numbers of these values \u200b\u200bis set by the order of the listing: The first value in the list receives the sequence number 0, the second - 1, etc. The maximum power of the type of type is 65536 values, so in fact the listed type specifies some subset of the whole type of Word and It can be considered as a compact announcement of a group of integer constants with values \u200b\u200bof 0, 1, etc.

The use of listed types increases the reliability of programs due to the ability to control those values \u200b\u200bthat appropriate variables. In Object Pascal, reverse conversion is allowed: Any Word type expression can be converted to the value of the type of type, unless the value of an integer expression does not exceed the power of this type. Such a conversion is achieved by using automatically declared function with the name of the type of listed.

Type-range. Type-range is a subset of its basic type, which can act as any sequence type, except for the type-range.

The type-range is set by the boundaries of its values \u200b\u200bwithin the basic type:

<мин.знач.>..<макс.знач.>

Here<мин. знач. > - the minimum type-range value;<макс. знач. > - The maximum value.

The type-range is not necessary in the Type section, and you can specify directly when the variable declarations.

When determining the type-band, you need to be guided by the following rules:

two characters ".." are considered as one character, so spaces are unacceptable between them; The left limit of the range should not exceed its right border.

The type-range inherits all the properties of its basic type, but with limitations associated with its lower power. In particular, if the variable is defined.

IN standard Library Object Pascal includes two functions that support work with bands:

HIGH (x) - Returns maximum value type-range to which the variable X owns;

Low (x) - returns the minimum value of the type-range.

Types of real types

In contrast to the ordinal types, the values \u200b\u200bof which are always compared with a number of integers and, therefore, are absolutely precisely precisely precisely, the values \u200b\u200bof the real types determine an arbitrary number only with some finite accuracy depending on the internal format of the real number.

Table 1.4 - Real Types

IN previous versions Delphi 1 ... 3 Type Real occupied 6 bytes and had a range of values \u200b\u200bfrom 2.9 * 10-39 to 1.7 * 1038. Versions 4 and 5 This type is equivalent to Double type. If required (for compatibility purposes), use 6-byte Real, you need to specify the compiler directive (SREALCOMPATILITY ON).

As can be seen from the table. 1.4, the real number in Object Pascal takes from 4 to 10 adjacent bytes and has the following structure in the PC memory.

Here s is a sign discharge; e - exponential part; contains binary order; M - Mantissa number.

Mantissa M has a length of 23 (for Single) to 63 (for extended) binary discharges, which provides accuracy of 7 ... 8 for Single and 19 ... 20 for extended decimal digits. The decimal point (comma) is meant before the left (senior) discharge of the mantissa, but under the actions with the number, its position is shifted to the left or right in accordance with the binary order of the number stored in the exponential part, so actions on real numbers are called a floating point arithmetic (comma) .

Note that the arithmetic coprocessor always processes the numbers in the extended format, and three other real types in this case are obtained by simple truncation of the results to the desired dimensions and are used mainly to save memory.

A special position in Object Pascal is occupied by the types of comp and currency, which are interpreted as real numbers with fractional parts of a fixed length: in the COMP, the fractional part has a length of 0 discharges, i.e. it is simply absent, in the Currency length of the fractional part -4 decimal discharge. In fact, both types define a large integer with a sign that retains 19 ... 20 significant decimal numbers (in the inner representation they occupy 8 adjacent bytes). At the same time, COMP and CURRENCY expressions are fully compatible with any other real types: all real operations are determined above them, they can be used as arguments of mathematical functions, etc. The most suitable area of \u200b\u200bapplication of these types is accounting calculations.

The method of structural algorithmization is one of system methods Development of algorithms. It is based on the visual representation of algorithms in the form of sequences of control structural fragments.

Each algorithm consists of elementary steps that can be combined into certain algorithmic structures: linear (consistent), branched , cyclic .

Definition 1.

Linear The design of the algorithm, implemented as a sequence of actions (steps), and each action (step) is performed only 1 time, after each action (step) an increase in the action (step) is performed to 1 until the value becomes greater than the final parameter of the algorithm .

With the help of linear algorithms represent linear processes. Algorithms of this type are used in describing the generalized solution of tasks in the form of module sequences.

Definition 2.

Branched (branching) Call an algorithmic design that provides a choice between 2 solutions variants depending on the input data values.

Branching are two types: incomplete (if something) I. full (if something else). With the help of full branch, you can organize 2 branches in the algorithm ( that or otherwise), each of which will lead to a common point of their merge, the algorithm will be carried out regardless of how much the solution went. In the presence of incomplete branch, some actions of the algorithm are assumed only on one branch ( that), since the second is missing, for one of the results of the validation of the actions, it is not necessary, the management will immediately go to the merge point. The basic variants of the branch structure are distinguished:

  1. Incomplete branch type "If something "In which all actions will be truthful to the condition.
  2. Full branch type "If - otherwise" At which 2 actions will be performed depending on the truth of the condition.
  3. Branching with type choices "That" , in which action 1 will be performed under condition 1, action 2 under condition 2, etc.
  4. Branching with type choices "Otherwise" At which, under condition 1, action will be performed 1, provided 2 action 2, etc., and otherwise all other actions will be performed.

Below are block diagrams of branching algorithms.

Definition 3.

Cyclic (or cycle) The design of the algorithm is called, in which some group of consecutive actions (steps) is performed several times depending on the condition of the task and input data.

Definition 4.

Such a group of recurring actions at every turn cycle called body cycle .

In any cyclic design, elements of the branching design of the algorithm are contained.

Three types are distinguished cyclic algorithm:

  • cycle with parameter (arithmetic cycle);
  • cycle with precondition;
  • the cycle with the postlaw (the last two is called iterative).

Arithmetic cycle

In a cycle of this type, the number of steps is uniquely determined by the rule of change in the parameter specified using its initial and end values, as well as the step of its change. Those., At each step of the cycle, the value of the parameter varies according to the cycle step until it reaches the value equal to the end value of the parameter.

Cycle with precondition

In this cycle, the number of steps is not defined in advance, it depends on the input data. In this cyclic structure, the value of the conditional expression (conditions) standing before performing the next step of the cycle is first checking. With the true meaning of the conditional expression, the cycle body will be executed. After that, the condition check will be performed again. These actions will be repeated until the meaning of the conditional expression becomes false, then the cycle will be completed.

A feature of this type of cycle is that with the initial felt of the conditional expression value, the cycle body will not be performed at all.

Cycle with postband

In this cyclic design, as in the previous one, the number of cycle repetitions is not determined in advance, it will depend on input parameters. A distinctive feature of the cycle with the precondition is that the body of the cycle with the postband in any case will be fulfilled at least 1 time and only after that the condition is tested. In this design, the cycle body is performed until the value of the conditional expression is false. As soon as it becomes true, the execution of commands will stop.

In real tasks, as a rule, there is any number of cycles.

Below are block diagrams of cyclic algorithms.

Data Types: Simple and Structured

Real data that is processed by the program include integers and real numbers, logical values \u200b\u200band symbols. They relate to simple data types and are called basic. All computer processed data is stored in its memory cells, each of which has its own address. In programming languages, there are variables that allow you to not pay attention to the address of the memory cells and access the name (identifier).

Definition 5.

Variable It is a named object (memory cell), changing its value.

The name of the variable indicates the value, and the address and method of its storage remain hidden from the prographogram. In addition to the name and values, variables have their own type that helps determine what type of information is in memory.

The variable type is set:

  • used method for recording information in the memory cell;
  • the required amount of memory for its storage.

For each type, the amount of memory is determined so that any value can be placed in it from the permissible range of values \u200b\u200bfor this type.

Definition 6.

Variables that are present in the program throughout the entire period of its work are called static .

Definition 7.

Variables that are created and destroyed at different stages of the implementation of the program are called dynamic Determination 10.

An array Call an ordered set of same type, which have a common name, sequence numbers at elements (indices).

The elements of the array are stored in the computer's memory next door in contrast to single elements. Arrays differ in the number of indexes of elements.

A one-dimensional array is characterized by the presence of only one index from each element. Examples of one-dimensional arrays are geometric and arithmetic sequences, which determine the final rows of numbers.

Definition 11.

The number of array elements is called dimension .

At the one-dimensional array, its dimension is recorded next to the name in parentheses.

Elements of a one-dimensional array are introduced alternately, in the order required to solve a specific task. If you need to enter the entire array, the elements are entered in order of increasing indexes.