Types of integers in pascal. Data types in Pascal

Any program written in any programming language is essentially designed to process data. The data can be numbers, texts, graphics, sound, etc. Some data are source data, others are the result, which is obtained by processing the source data by the program.

The data is stored in the computer's memory. The program accesses them using variable names associated with the memory locations where the data is stored.

Variables are described before the main program code. The names of the variables and the type of data stored in them are indicated here.

There are a lot of data types in the Pascal programming language. In addition, the user himself can define his own types.

The type of a variable determines what data can be stored in the memory location associated with it.

Type variables integer can only be associated with integer values ​​typically in the range -32768 to 32767. Pascal has other integer types (byte, longint).

Type variables real store real (fractional) numbers.

Variable Boolean(Boolean) type (boolean) can take only two values ​​- true(1, true) or false(0, false).

Character type (char) can take values ​​from a specific ordered sequence of characters.

Interval type defined by the user and formed only from ordinal types. Represents a subset of values ​​in a specific range.

You can create your own data type by simply listing the values ​​that a variable of that type can take. This is the so-called enumerated data type.

All of the above are simple data types. But there are also complex, structured ones, which are based on simple types.

Array is a structure that occupies a single area in memory and consists of a fixed number of components of the same type.

Strings is a sequence of characters. Moreover, the number of these characters cannot be more than 255 inclusive. This limitation is a characteristic feature of Pascal.

Record is a structure consisting of a fixed number of components called fields. Data in different fields of a record can be of different types.

Sets represent a collection of any number of elements, but of the same enumerated type.

Files for Pascal, they are sequences of the same type of data that are stored on external memory devices (for example, a hard drive).

The concept of such a data type as pointer associated with dynamic storage of data in computer memory. Often, using dynamic data types is more efficient in programming than using static data types.

The simplest numeric data type in Pascal is the integer types, designed to store integers. Integers in Pascal are usually divided into two types: signed and unsigned. Signed numbers are an integer type that includes both positive and negative numbers, unsigned numbers are only positive numbers.

Below are two tables with integer types. First we'll write out signed integer types:


TypeByteRange of values
shortint1 -128 ... 127
smallint2 -32768 ... 32767
integer, longint4 -2147483648 ... 2147483647
int648 -9223372036854775808 ... 9223372036854775807

And this unsigned integer types:


TypeByteRange of values
byte1 0 ... 255
word2 0 ... 65535
longword, cardinal4 0 ... 4294967295
uint648 0 ... 18446744073709551615

As you can see, the first column contains the name of the type, the second - the number of bytes occupied in memory by numbers of this type, and the third - the range of possible values, respectively. There are two types of signed numbers - integer and longint (literally "integer" and "long integer"), which are synonymous. That is, you can use one name or another in the description section.

Similarly, in the second table (non-negative integers in Pascal), there are also two 4-byte synonym integer types - longword and cardinal , so use one or the other.

You can also notice that if we conditionally move the numbers of the first table to the right side relative to zero (move the interval to the right so that the minimum number is 0), then we will get intervals of integers in the second table lying in the corresponding rows. So, if in a 1-byte shortint type we add 128 to the left and right boundaries, we get the byte type (0..255); if in a 2-byte type smallint we add 32768 to the boundaries, we get the corresponding 2-byte unsigned type word (0..65535), etc.

All this happens because in unsigned integer types, numbers can be divided exactly in two: half the numbers into the negative part, half into the positive part. Why then in signed numbers is the left border in absolute value 1 greater than the right border? - you ask. For example, in the shortint type the minimum is -128, while the maximum is only 127 (modulo 1 less). And this is because the right side also includes 0, and you need to know and remember this.

So why do integers in Pascal need to be divided into so many types? Why not get by, for example, with the largest of the integer types in PascalABC.Net and Free Pascal – int64 – which is almost 9 and a half quintillion (!) with both a minus and a plus? Yes, for a simple banal (?) reason - saving memory. If you need to add two small one-byte positive numbers (0..255), and you described these numbers as int64 (8 bytes), then this took 8 times more memory. And if the program is large and there are a lot of variables, then memory savings rise very sharply. Moreover, there is no point in using signed integer types if the problem deals with quantities such as length, mass, distance, time, etc.

In the Abrahamyan Problem Book section of the site (Integer subsection), observe the use of various integer types in Pascal.

In any program, you need to determine the type and type of quantities that will be used to solve the problem. By type, simple quantities (in programming they are all called data) are divided into constants and variables.

Constants– this is data whose values ​​cannot change during program execution. Entered in a const block.

In general, the description of a simple untyped constant is done as follows:

Const constant_name = expression;

Typed constants are described as:

Const constant_name: type = expression;

The following can be used in expressions:

· numbers or a set of characters in apostrophes;

· mathematical operations;

· relational and logical operations;

· functions abs(x), round(x), trunc(x);

· functions chr(x), ord(x), pred(x), succ(x) and others.

Constant description format:

id=value;

1. Integers - defined by numbers written in decimal or hexadecimal format, without a decimal point.

2. Real - defined by numbers written in decimal data format.

3. Characters are any personal computer symbol enclosed in apostrophes.

4. String – defined by a sequence of arbitrary characters enclosed in apostrophes.

5. Boolean - this is either False or True.

The type of the constant is not specified, but is determined automatically during compilation: the values ​​of expressions are immediately calculated, and subsequently only substituted for names.

Variables- This is data that can change during program execution. Each variable has its own named memory location/locations. Those. a variable is a kind of container in which you can put some data and store it there. Variables have a name, a type, and a value.

Variable name must begin with a letter, cannot contain spaces, and can only contain:

· letters of the Latin alphabet;

· underscore.

Examples: A, A_1, AA, i, j, x, y, etc. Incorrect names: My 1, 1A. Variable names can be up to 126 characters long, so try to choose meaningful variable names. However, the compiler distinguishes the first 63 characters in names. But it does not distinguish between lowercase and uppercase letters, both in variable names and in the writing of service identifiers.

Variable type – must be defined in the VAR variable description block. The value of a variable is a constant of the same type.

Every program works with data. Data is, in the broad sense of the word, objects that a program processes. The type of a given is its characteristic. Depends on the type:

· in what form will this data be stored,

How many memory cells will be allocated for its storage,

what is the minimum and maximum value it can take,

· what operations can be performed with it.

Some simple Pascal data types:

1. Integer types (ShortInt, Integer, LongInt, Byte, Word).

2. Real types (Real, Single, Double, Extended, Comp).

3. Logical (Boolean).

4. Character (Char).

5. String types (String, String [n]).

9. Unconditional operators in Pascal. Description and use.

Operator type

goto<метка>;

Purpose – transfer of control in the program to the operator marked with the label<метка>. A label can be a name (written according to the rules for language names) or an unsigned integer described in the Label label statement and placed before the labeled statement, but only in one place in the program. A label is separated from the operator by the “:” symbol. A transition to a label can occur several times in a block, but the label itself can only appear once. If there is no control transfer to some label, there will be no error.

The unconditional jump operator is generally not allowed in structured programming. Although it allows you to shorten the program text, its use in Pascal is limited by a number of rules and recommendations. It is prohibited to jump inside a compound statement, inside or to the beginning of a subroutine, and exit from a subroutine to the program that called it. It is not recommended to move beyond the page (screen) of the program text, except for moving to the final statements of the program. All this is due to the possibility of skipping important statements for the correct functioning of the program. Typically, the unconditional jump operator is used only to return to the beginning of the loop body if the loop is constructed using conditional and unconditional operators.

Note that the statement following goto must also be marked with a different label (if goto is not the last in the group of statements). Otherwise, there is no way to get to the next goto statement.

10. Branch operators in Pascal. Description and use.

Operators that allow you to select only one from several possible options for executing a program (branches) include

Those. These statements allow you to change the natural order of execution of program statements.

if<условие>then< оператор 1 >

else<оператор 2> ;

if a>=b then Max:=a else Max:=b;

In an if statement, only one statement can be executed on both branches (then and else)!

An example of a problem on branch operators in Pascal. Enter two integers and display the largest of them.

Solution idea: you need to display the first number if it is greater than the second, or the second if it is greater than the first.

Feature: the actions of the performer depend on certain conditions (if... otherwise...).

var a, b, max: integer;

writeln("Enter two integers");

if a > b then max:=a else max:=b;

writeln("Maximum number", max);

Difficult conditions

A complex condition is a condition consisting of several simple conditions (relations) connected using logical

operations:

Not – NOT (negation, inversion)

And – And (logical multiplication, conjunction,

simultaneous fulfillment of conditions)

Or – OR (logical addition, disjunction,

fulfillment of at least one of the conditions)

Xor – exclusive OR (execute only

one of the two conditions, but not both)

Simple conditions (relationships)

< <= > >= = <>

Execution order (priority = seniority)

Expressions in parentheses

<, <=, >, >=, =, <>

Feature - each of the simple conditions must be enclosed in brackets.

case selection operator

The case statement allows you to choose between several options.

The variant operator consists

From an expression called a selector,

A list of operators, each marked with a constant of the same type as the selector.

The selector must only be an ordinal data type, not a longint data type.

The selector can be a variable or an expression.

The list of constants can be specified either by an explicit enumeration, or by an interval, or by combining them. Repetition of constants is not

allowed.

The switch type and the types of all constants must be compatible.

Case< выражение {селектор}>of

<список констант 1> : < оператор 1>;

< список констант K> : < оператор K>;

The case statement is executed as follows:

1) the value of the selector is calculated;

2) the result obtained is checked to see if it belongs to a particular list of constants;

3) if such a list is found, then no further checks are performed, but the operator corresponding to

selected branch, after which control is transferred to the statement following the end keyword, which closes the entire

case construct;

4) if there is no suitable list of constants, then the operator following the else keyword is executed; if there is no else branch,

then nothing is done.

In a case branch statement, only one statement can be executed across all branches!

If you need to execute more than one, you need to use the begin-end operator brackets.

case Index mod 4 of

1: x:= y*y – 2*y;

11.Option (selection) operator in Pascal. Description and use.

The selection operator (option, switch) implements the choice of one of the possible alternatives, i.e. options for continuing the program.

Recording format:

Case – choice, option;

S – selector, expression of ordinal type;

Ki – selection constants, a constant whose type matches the selector type;

OPi – any operator, including empty;

The selection operator implements the following construct:

The operation of the selection operator in Pascal: The selector expression is evaluated. The calculated value is sequentially compared with the alternative constants and control is transferred to the selection constant operator, which coincides with the calculated selector value. The statement is executed and control is transferred beyond the select statement. If the calculated value of the selector does not match any of the constants, then control is transferred to the Else branch, the presence of which is not necessary; in this case, control is transferred outside the selection operator.

Block diagram of the selection operator.

The structure of the selection statement can be implemented using nested conditional statements, but this reduces the visibility of the program. No more than 2-3 levels of investment are recommended.

12. Types of loop operators in Pascal, their purpose.

5. Algorithmic constructions of cycles. Types of cycles.

There are three types of loop algorithms: loop with a parameter (called an arithmetic loop), loop with a precondition, and loop with a postcondition (called iterative).

12.13 Arithmetic loop. In an arithmetic cycle, the number of its steps (repetitions) is uniquely determined by the rule for changing the parameter, which is specified using the initial (N) and final (K) values ​​of the parameter and the step (h) of its change. That is, at the first step of the cycle the parameter value is N, at the second - N + h, at the third - N + 2h, etc. At the last step of the cycle, the value of the parameter is not greater than K, but such that its further change will lead to a value greater than K.

Counter loops are used when a cyclic portion of a program must be repeated a fixed number of times. Such loops have an integer variable called the loop counter.

If it is necessary for a program fragment to be repeated a specified number of times, then the following construction is used:

FOR<имя счетчика цикла> = <начальное значение>THAT<конечное значение>DO<оператор>;

FOR, TO, DO - reserved words (English: for, to, perform);

<счетчик (параметр) цикла>- a variable of type INTEGER, which changes on the interval from<начального значения>, increasing by one at the end of each step of the cycle;

<оператор>- any (usually compound) operator.

There is another form of this operator:

FOR<имя счетчика цикла>:= <начальное значение>DOWNTO<конечное значение>DO<оператор> :

Replacing TO with DOWNTO (English: down to) means that the step of changing the cycle parameter is equal to - 1, i.e. the counter is decreasing step by step by one.

12.14 Loop with precondition. The number of steps in the cycle is not predetermined and depends on the input data of the task. In this cyclic structure, the value of a conditional expression (condition) is first checked before executing the next step of the loop. If the conditional expression is true, the body of the loop is executed. After which control is again transferred to checking the condition, etc. These actions are repeated until the conditional expression evaluates to FALSE. The first time the condition is not met, the cycle ends.

This most commonly used repetition operator is:

WHILE<условие>DO<оператор>;

WHILE, DO - reserved words (English: bye, do);

<условие>- expression of logical type;

<оператор>- an arbitrary (possibly compound) operator.

A special feature of a loop with a precondition is that if the conditional expression is initially false, then the body of the loop will never be executed.

Loops with preconditions are used when the execution of the loop is associated with some logical condition. A loop statement with a precondition has two parts: the loop execution condition and the loop body.

12.15 Loop with postcondition (iterative loop). As in a loop with a precondition, in a cyclic design with a postcondition the number of repetitions of the loop body is not predetermined; it depends on the input data of the task. Unlike a loop with a precondition, the body of a loop with a postcondition will always be executed at least once, after which the condition is checked. In this design, the body of the loop will be executed as long as the value of the conditional expression is false. Once it becomes true, the command stops executing.

This operator looks like:

REPEAT<тело цикла>UNTIL<условие>:

REPEAT, UNTIL - reserved words (English: repeat until not);

<условие>- an expression of logical type, if its value is true, then the loop exits.

It should be noted that in this construction, the sequence of statements defining the body of the loop is not enclosed in operator brackets BEGIN ... END, since they are the pair REPEAT ... UNTIL.

Postcondition loops are similar to precondition loops, but they place the condition after the body of the loop.

Unlike a loop with a precondition, which can terminate without ever executing the body of the loop (if the execution condition is false on the first pass of the loop), the body of a loop with a postcondition must be executed at least once, after which the condition is checked.

One of the loop body operators must affect the value of the loop execution condition, otherwise the loop will be repeated an infinite number of times.

If the condition is true, then the loop is exited, otherwise the loop statements are repeated.

16. Array- this is a set of elements of the same type, united by a common name and occupying a certain memory area in the computer. The number of elements in an array is always finite. In general, an array is a structured data type consisting of a fixed number of elements of the same type. Arrays received the name regular type (or rows) because they combine elements of the same type (logically homogeneous), ordered (regulated) by indices that determine the position of each element in the array. Any type of data can be used as elements of an array, so it is quite legitimate to have arrays of records, arrays of pointers, arrays of strings, arrays, etc. Elements of an array can be data of any type, including structured ones. The type of array elements is called base. A feature of the Pascal language is that the number of array elements is fixed during the description and does not change during program execution. The elements that make up the array are ordered in such a way that each element has a corresponding set of numbers (indices) that determine its location in the overall sequence. Each individual element is accessed by indexing the elements of the array. Indexes are expressions of any scalar type (usually integer), except real. The index type determines the boundaries for changing index values. The phrase array of is used to describe an array.

An array is a collection of data that performs similar functions and is designated by one name. If each element of an array has only one serial number assigned to it, then such an array is called linear, or one-dimensional.

17. One-dimensional array– this is a fixed number of elements of the same type, united by one name, and each element has its own unique number, and the element numbers are consecutive.

To describe such objects in programming, you must first enter the corresponding type in the type description section.

The array type is described as follows:

Type name = Array [index(s) type] Of elements type;

Variable name: type name;

An array variable can be described immediately in the Var variable description section:

Var Variable name: array [type of index(es)] Of element type;

Array is a service word (translated from English as “array”);

Of is a service word (translated from English as “from”).

Index type – any ordinal type, except for the integer and longint types.

The type of the elements themselves can be anything except file type.

The number of elements in an array is called its dimension. It is easy to calculate that with the last method of describing a set of indexes, the array dimension is equal to: maximum index value – minimum index value + 1.

For example:

mas = array of real;

Array X is one-dimensional, consisting of twenty elements of the real type. The array elements are stored in computer memory sequentially one after another.

When using variables to denote an index, their values ​​must be determined at the time of use, and in the case of arithmetic expressions, their result must not exceed the boundaries of the minimum and maximum values ​​of the array indices.

Array element indices can start with any integer, including negative ones, for example:

Type bb = Array [-5..3] Of Boolean;

Arrays of this type will contain 9 logical variables, numbered from -5 to 3.

18. Two-dimensional array in Pascal is treated as a one-dimensional array whose element type is also an array (array of arrays). The position of elements in two-dimensional Pascal arrays is described by two indices. They can be presented in the form of a rectangular table or matrix.

Consider a two-dimensional Pascal array with a dimension of 3*3, that is, it will have three lines, and each line will have three elements:

Each element has its own number, like one-dimensional arrays, but now the number already consists of two numbers - the number of the row in which the element is located, and the column number. Thus, the element number is determined by the intersection of a row and a column. For example, a 21 is the element that appears in the second row and first column.

Description of a two-dimensional Pascal array.

There are several ways to declare a two-dimensional Pascal array.

We already know how to describe one-dimensional arrays, the elements of which can be of any type, and, therefore, the elements themselves can be arrays. Consider the following description of types and variables:

Basic operations with two-dimensional Pascal arrays

Everything that has been said about basic operations with one-dimensional arrays is also true for matrices. The only action that can be performed on entire matrices of the same type is assignment. That is, if our program describes two matrices of the same type, for example,

matrix= array of integer;

then during program execution you can assign matrix a the value of matrix b (a:= b). All other actions are performed element by element, and all valid operations that are defined for the data type of the array elements can be performed on the elements. This means that if an array consists of integers, then operations defined for integers can be performed on its elements, but if the array consists of characters, then operations defined for working with characters can be applied to them.

21. Technologies for working with text documents. Text editors and processors: purpose and capabilities.

More advanced text editors (for example, Microsoft Word and OpenOffice.org Writer), which are sometimes called word processors, have a wide range of capabilities for creating documents (inserting lists and tables, spell checking tools, saving corrections, etc.).

To prepare for the publication of books, magazines and newspapers in the process of publication layout, powerful text processing programs are used - desktop publishing systems (for example, Adobe PageMaker, Microsoft Office Publisher).

To prepare Web pages and Web sites for publication on the Internet, specialized applications (for example, Microsoft FrontPage) are used.

Text editors are programs for creating, editing, formatting, saving and printing documents. A modern document may contain, in addition to text, other objects (tables, diagrams, pictures, etc.).

Editing is a transformation that adds, deletes, moves or corrects the content of a document. Editing a document is usually done by adding, deleting, or moving characters or pieces of text.

Formatting is the design of text. In addition to text characters, formatted text contains special invisible codes that tell the program how it should be displayed on the screen and printed on a printer: what font to use, what the style and size of the characters should be, how paragraphs and headings should be formatted.

Formatted and unformatted texts are somewhat different in nature. This difference must be understood. In formatted text, everything is important: the size of the letters, their image, and where one line ends and another begins. That is, formatted text is inextricably linked to the parameters of the sheet of paper on which it is printed.

When designing text documents, you often need to add non-text elements or objects to the document. Advanced text editors allow you to do this - they have ample opportunities for inserting pictures, diagrams, formulas, and so on into the text.

Paper and electronic documents. Documents can be paper or electronic. Paper documents are created and formatted to provide the best possible presentation when printed on a printer. Electronic documents are created and formatted for best presentation on a computer screen. The gradual replacement of paper document flow with electronic one is one of the trends in the development of information technology. Reducing paper consumption has a beneficial effect on conserving natural resources and reducing environmental pollution.

The formatting of paper and electronic documents can differ significantly. For paper documents, the so-called absolute formatting is accepted. A printed document is always formatted to fit a printed sheet of known size (format). For example, the width of a document line depends on the width of the sheet of paper. If a document was designed for printing on large format sheets, then it cannot be printed on small sheets of paper - part of the document will not fit on them. In a word, formatting a printed document always requires first selecting a sheet of paper and then linking it to this sheet. For a printed document, you can always accurately indicate (in any units of measurement) the sizes of fonts, margins, distances between lines or paragraphs, etc.

For electronic documents, so-called relative formatting is common. The author of the document cannot predict in advance on what computer or screen size the document will be viewed. Moreover, even if the screen sizes were known in advance, it would still be impossible to predict what the size of the window in which the reader will see the document will be. Therefore, electronic documents are made to adapt to the current window size and format on the fly.

The author of an electronic document also does not know what fonts are available on the computer of the future reader, and therefore cannot strictly indicate in what font the text and headings should be displayed. But it can set formatting that will make headings appear larger than text on any computer.

Relative formatting is used to create electronic Internet documents (so-called Web pages), and absolute formatting is used to create printed documents in word processors.

22.Main structural elements of a text document. Fonts, styles, formats.

Font (character) formatting.

Symbols are letters, numbers, spaces, punctuation marks, and special characters. Symbols can be formatted (change their appearance). Among the main properties of symbols are the following: font, size, style and color.

A font is a complete set of characters of a certain style. Each font has its own name, for example Times New Roman, Arial, Comic Sans MS. The font unit is the point (1 pt = 0.367 mm). Font sizes can be changed within wide limits. In addition to the normal (regular) style of characters, bold, italic, and bold italic are usually used.

Depending on the way they are presented on a computer, there are differences between raster and vector fonts. Raster graphics methods are used to represent raster fonts; font characters are groups of pixels. Bitmap fonts can only be scaled by certain factors.

In vector fonts, characters are described by mathematical formulas and can be scaled arbitrarily. Among vector fonts, TrueType fonts are the most widely used.

You can also set additional character formatting options: underlining characters with different line types, changing the appearance of characters (superscript, subscript, strikethrough), changing the spacing between characters.

If you plan to print a document in color, you can specify different colors for different groups of characters.

To check spelling and syntax, special software modules are used, which are usually included in word processors and publishing systems. Such systems contain dictionaries and grammar rules for several languages, which makes it possible to correct errors in multilingual documents.

24. Database is an information model that allows you to orderly store data about a group of objects that have the same set of properties.

There are several different types of databases: tabular (relational), hierarchical and network.

Tabular databases.

A tabular database contains a list of objects of the same type, that is, objects with the same set of properties. It is convenient to represent such a database in the form of a two-dimensional table.

In relational databases, all data is presented in the form of simple tables, divided into rows and columns, at the intersection of which the data is located. Queries on such tables return tables that themselves can be the subject of further queries. Each database can contain multiple tables.

The main advantage of tables is their clarity. We deal with tabular information almost every day. Take a look, for example, at your diary: the class schedule is presented there in the form of a table. When we arrive at the station, we look at the train schedule. What kind does it look like? This is a table! There is also a football championship table. And the teacher’s journal, where he gives you grades, is also a table.

Briefly, the features of a relational database can be formulated as follows:

1.Data is stored in tables consisting of columns (“attributes”, “fields”) and rows (“records”);

2. At the intersection of each column and row there is exactly one value;

3.Each column has its own name, which serves as its name, and all values ​​in one column are of the same type.

4.Queries to the database return results in the form of tables, which can also act as query objects.

5.Rows in a relational database are unordered - ordering is done at the moment the response to the query is generated.

6.Usually information in databases is stored not in one table, but in several interrelated ones.

In relational databases, a table row is called recording, and the column is field. Each table field has a name.

Fields- these are various characteristics (sometimes called attributes) of an object. Field values ​​in one line refer to one object.

Primary key in a database, a field (or a set of fields) is called whose value is not repeated in different records.

Each field has one more very important property associated with it: field type. A field type defines the set of values ​​that a given field can take on in different records.

There are four main field types used in relational databases:

Numerical;

Symbolic;

Logical.

25. Database management systems and principles of working with them. Search, delete and sort data in the database. Search conditions (logical expressions); order and sort keys.

Database management systems (DBMS).

To create databases, as well as perform search and sort operations, special programs are used - database management systems (DBMS).

Thus, it is necessary to distinguish between databases (DBs) themselves - ordered sets of data, and database management systems (DBMS) - programs that manage the storage and processing of data. For example, the Access application, included in the Microsoft Office office suite, is a DBMS that allows the user to create and process tabular databases.

A relational database is essentially a two-dimensional table. A record here is understood as a row of a two-dimensional table, the elements of which form the columns of the table. Depending on the data type, the columns can be numeric, text, or date. The table rows are numbered.

Working with a DBMS begins with creating a database structure, i.e., with defining:

number of columns;

column names;

column types (text/number/date);

column widths.

Main functions of the DBMS:

Managing data in external memory (on disks);

Managing data in RAM;

Logging changes and restoring the database after failures;

Support of database languages ​​(data definition language, data manipulation language).

In DBMS commands, the selection condition is written in the form of a logical expression.

A logical expression, like a mathematical expression, is executed (evaluated), but the result is not a number, but a logical value: true or false.

An expression consisting of one logical value or one relation will be called a simple logical expression.

Often there are problems in which not individual conditions are used, but a set of interconnected conditions (relations). For example, you need to select students whose weight is more than 60 and whose height is less than 168.

An expression containing logical operations will be called a complex logical expression.

Combining two (or more) statements into one using the conjunction “and” is called the operation of logical multiplication or conjunction.

As a result of logical multiplication (conjunction), truth is obtained if all logical expressions are true.

Combining two (or more) statements using the conjunction “or” is called the operation of logical addition or disjunction.

As a result of logical addition (disjunction), truth is obtained if at least one logical expression is true.

Attaching the particle “not” to a statement is called the operation of logical negation or inversion.

27. Spreadsheets, purpose and basic functions.

Spreadsheet is a numerical data processing program that stores and processes data in rectangular tables.

A spreadsheet consists of columns and rows. Column headings are designated by letters or combinations of letters (A, G, AB, etc.), row headings are designated by numbers (1, 16, 278, etc.). A cell is the intersection of a column and a row.

Each table cell has its own address. A spreadsheet cell address is made up of a column header and a row header, for example: A1, F123, R1. The cell with which some actions are performed is highlighted with a frame and is called active.

Data types. Spreadsheets allow you to work with three main types of data: number, text, and formula.

Numbers in Excel spreadsheets can be written in regular numeric or exponential format, for example: 195.2 or 1.952E + 02. By default, numbers are aligned to the right in a cell. This is explained by the fact that when placing numbers under each other (in a table column), it is convenient to have alignment by digits (units under units, tens under tens, etc.).

The formula must begin with an equal sign and can include numbers, cell names, functions (Math, Statistical, Financial, Date and Time, etc.), and mathematical symbols. For example, the formula “=A1+B2” provides the addition of numbers stored in cells A1 and B2, and the formula “=A1*B” multiplies the number stored in cell A1 by 5. When you enter a formula in a cell, it is not the formula itself that is displayed; and the result of calculations using this formula. If the initial values ​​included in the formula change, the result is recalculated immediately.

Absolute and relative links. Formulas use references to cell addresses. There are two main types of links: relative and absolute. The differences between them appear when you copy a formula from the active cell to another cell.

A relative reference in a formula is used to specify a cell address that is calculated relative to the cell in which the formula is located. When you move or copy a formula from the active cell, relative references are automatically updated based on the new position of the formula. Relative links have the following form: A1, BZ.

If the dollar sign precedes a letter (for example: $A1), then the column coordinate is absolute, and the row coordinate is relative. If the dollar symbol is in front of a number (for example, A$1), then, on the contrary, the column coordinate is relative, and the row coordinate is absolute. Such links are called mixed.

For example, let the formula =A$1+$J31 be written in cell C1, which when copied to cell D2 takes the form =B$1+$B2. Relative links changed when copied, but absolute links did not.

Sorting and searching data. Spreadsheets allow you to sort data. Data in spreadsheets is sorted in ascending or descending order. When sorting, data is arranged in a certain order. You can perform nested sorts, i.e., sort data by several columns, and assign a sorting sequence for the columns.

In spreadsheets, you can search for data in accordance with specified conditions - filters. Filters are defined using search terms (greater than, less than, equal to, etc.) and values ​​(100, 10, etc.). For example, more than 100. As a result of the search, those cells will be found that contain data that matches the specified filter.

Constructing charts and graphs. Spreadsheets allow you to present numerical data in the form of charts or graphs. Charts come in different types (bar, pie, etc.); The choice of chart type depends on the nature of the data.

28. Technology of information processing in spreadsheets (ET). Spreadsheet structure.

A spreadsheet is a numerical data processing program that stores and processes data in rectangular tables. A spreadsheet consists of columns and rows. Column headings are designated by letters or combinations of letters (A, G, AB, etc.), row headings are designated by numbers (1, 16, 278, etc.). A cell is the intersection of a column and a row. Each table cell has its own address. A spreadsheet cell address is made up of a column header and a row header, for example: Al, B5, E7. The cell with which some actions are performed is highlighted with a frame and is called active. The spreadsheets that the user works with in the application are called worksheets. You can enter and change data on multiple sheets at once, and perform calculations based on data from multiple sheets. Spreadsheet documents can include multiple worksheets and are called workbooks.

29. Data types in spreadsheets (ET): numbers, formulas, text. Rules for writing formulas.

Data types.

Spreadsheets allow you to work with three main types of data: number, text, and formula.

Numbers in Excel spreadsheets can be written in regular numeric or exponential format, for example: 195.2 or 1.952Ё + 02. By default, numbers are aligned to the right in a cell. This is explained by the fact that when placing numbers under each other (in a table column), it is convenient to have alignment by digits (units under units, tens under tens, etc.).

Text in Excel spreadsheets is a sequence of characters consisting of letters, numbers and spaces, for example the entry “32 MB” is text. By default, text is aligned left in a cell. This is due to the traditional way of writing (from left to right).

The formula must begin with an equal sign and can include numbers, cell names, functions (Math, Statistical, Financial, Date and Time, etc.) and symbols of mathematical operations. For example, the formula “=A1+B2” provides the addition of numbers stored in cells A1 and B2, and the formula “=A1*5” multiplies the number stored in cell A1 by 5. When you enter a formula in a cell, it is not the formula itself that is displayed; and the result of calculations using this formula. If the initial values ​​included in the formula change, the result is recalculated immediately.

Rules for writing formulas in spreadsheets

1. Formulas contain numbers, cell names, operation signs, parentheses, function names

2. Arithmetic operations and their signs:

Operation name Symbol Key combination

addition + (Shift + +=)or (+) on the additional keyboard

subtraction – (-)

multiplication * (Shift + 8) or (*) on an additional keyboard

division / (Shift + | \) or (/) on an additional keyboard

exponentiation ^ (Shift + 6) in English

3. The formula is written in a line, the symbols are sequentially lined up one after another, all the operation signs are entered; parentheses are used.

4. The operations in brackets are performed first; if there are no brackets, then the order of execution is determined by the precedence of the operations. In descending order of precedence, operations are arranged in the following order:

1. exponentiation

2. multiplication, division

3. addition, subtraction

Operations of the same precedence are performed in the order they are written from left to right.

5. Formulas can be entered in the calculation display mode, i.e. The user begins writing a formula in the current cell with the = sign, and after pressing the Enter key, the result of the calculation using the formula is displayed in the cell.

6. Formulas can be entered in the formula display mode, i.e. the user writes a formula into the current cell without the = sign and the formula is displayed in the cell after pressing the Enter key.

30.Basic built-in functions. Absolute and relative links in spreadsheets (ET).

A relative reference in a formula is used to specify a cell address that is calculated relative to the cell in which the formula is located. When you move or copy a formula from the active cell, relative references are automatically updated based on the new position of the formula. Relative links have the following form: A1, ВЗ.

An absolute reference in a formula is used to specify a fixed cell address. When you move or copy a formula, absolute references do not change. In absolute references, the immutable cell address value is preceded by a dollar sign (for example, $A$1).

If the dollar symbol precedes a letter (for example: $A1), then the column coordinate is absolute, and the row coordinate is relative. If the dollar symbol is in front of a number (for example, A$1), then, on the contrary, the column coordinate is relative, and the row coordinate is absolute. Such links are called mixed. For example, let the formula =A$1+$B1 be written in cell C1, which when copied to cell D2 takes the form =B$1+$B2. Relative links changed when copied, but absolute links did not.

LECTURE 2

Basics of programming.

Introduction to Pascal. Data types. Operations.

Language alphabetPascal

Any natural language consists of elements such as symbols, words, phrases, and sentences. A programming language also has similar elements: symbols, words, expressions (phrases), operators (sentences).

Words are formed from a collection of symbols. Expressions - these are groups of words, and operators - These are combinations of words and expressions. Language symbols are elementary signs (letters) that are used to compose some texts. So, the set of these symbols forms the alphabet of the language.

The Pascal alphabet consists of:

1.uppercase and lowercase letters of the Latin alphabet, which includes the following characters:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z - capital letters;

A b c d e f g h i j k l m n o p q r s t u v w x y z - lowercase letters;

2. decimal Arabic numerals: 0 1 2 3 4 5 6 7 8 9;

3. hexadecimal digits (constructed from decimal digits and letters from A to F);

4. 32 uppercase and lowercase letters of the Russian alphabet;

5. special characters:

Combinations of special characters can form compound characters:

: = assignment;

< >not equal;

>= greater than or equal to;

<= меньше или равно;

Range of values;

(* *) or ( ) - comment.

Pascal program structure

In order for the Passal compiler to correctly understand exactly what actions are expected of it, your program must be formatted in full accordance with the syntax (rules of program construction) of this language.

Any Pascal program can consist of the following blocks (optional parts are marked with square brackets hereafter):

program<имя_программы>;

[uses<имена_подключаемых_модулей>;]

[ label<список_меток>;]

[ const<имя_константы> = <значение_константы>;]

[ type<имя_типа> = <определение_типа>;]

[var<имя_переменной> : <тип_переменной>;]

[ procedure<имя_процедуры> <описание_процедуры>;]

[ function<имя_функции> <описание_функции>;]

begin (beginning of the main body of the program)

<операторы>

end. (* end of the main body of the program *)

Later versions of Pascal language compilers no longer require specifying the program name, that is, the program line<имя_программы>; can be omitted. But this is only possible if the entire program is contained in one module file. If the program consists of several independent pieces - modules, then each of them must have a header (program or unit).

Any of the listed optional sections can appear more than once in the program text, their general sequence can also change, but the main rule of the Pascal language must always be followed: before an object is used, it must be declared and described.

Pascal compilers do not distinguish between lowercase and uppercase letters and ignore whitespace characters, so the program text can be structured in such a way as to make it most convenient to read and debug.

Compiler directives

The line beginning with the characters ($ is not a comment, but a compiler directive - a special command on which the process of compilation and execution of the program depends. We will consider directives in those sections to which they relate “by meaning”.

For example, the line ($I-,Q+) disables I/O validation but enables computation overflow control.

Identifiers

The names given to program objects (constants, types, variables, functions and procedures, and the entire program) are called identifiers. They can only consist of numbers, Latin letters and the "_" (underscore) sign. However, a number cannot begin a name. Identifiers can be any length, but if two names have the same first 63 characters, then the names are considered identical.

You can give your program objects any name, but you must make sure that they are different from the reserved words used by Pascal, because the compiler will still not accept variables with "foreign" names.

Here is a list of the most common reserved words:

array implementation shl

case interface string

const label then

file pointer uses

far procedure var

for program while

forward record with

function repeat xor

Variables and data types

A variable is a program object whose value can change while the program is running.

A data type is a characteristic of the range of values ​​that variables belonging to that data type can take.

All variables used in the program must be described in a special var section using the following template:

var<имя_переменной_1> [, <имя_переменной_2, _>] : <имя_типа_1>;

<имя_переменной_3> [, <имя_переменной_4, _>] : <имя_типа_2>;

The Pascal language has a large set of different data types, but now we will indicate only a few of them. We will talk about all data types further.

Constants

A constant is an object whose value is known before the program starts running.

Constants are necessary for the design of visual programs, are indispensable when using repeatedly repeated values ​​in the text of a program, and are convenient if it is necessary to change these values ​​throughout the entire program at once.

There are three types of constants in Pascal:

Unnamed constants (digits and numbers, symbols and strings, sets);

Named untyped constants;

Named typed constants.

Unnamed Constants

Unnamed constants have no names and therefore do not need to be declared.

The type of an unnamed constant is determined automatically, by default:

Any sequence of numbers (perhaps preceded by a "-" or "+" sign, or broken up by a single dot) is perceived by the compiler as an unnamed constant - a number (integer or real);

Any sequence of characters enclosed in apostrophes is treated as an unnamed constant - a string;

Any sequence of integers or symbols separated by commas, framed by square brackets, is perceived as an unnamed constant - a set.

In addition, there are two special constants true and false related to the Boolean data type.

Examples of using unnamed constants include the following operators:

real2:= 12.075 + x;

string4:= "abc" + string44;

set5:= * set55;

boolean6:= true;

Untyped Constants

Named constants, as their name suggests, must have a name. Therefore, these names must be reported to the compiler, that is, described in a special const section.

If you do not specify the type of a constant, then by its appearance the compiler itself will determine which (base) type it should be assigned to. Any constant already described can be used when declaring other constants, variables and data types. Here are some examples of describing untyped named constants:

Typed Constants

Typed named constants are variables(!) with an initial value that is already known by the time the program starts. Therefore, firstly, typed constants cannot be used to define other constants, data types and variables, and secondly, their values ​​can be changed while the program is running.

Typed constants are described using the following template:

const<имя_константы> : <тип_константы> = <начальное_значение>;

The examples below show how to do this:

const n: integer = -10;

b: boolean = true;

We will provide examples of typed constants of other types as we study the corresponding data types.

Pascal data types

Pascal compilers require that information about the amount of memory required to run a program be provided before it runs. To do this, in the variable description section (var), you need to list all the variables used in the program. In addition, you also need to tell the compiler how much memory each of these variables will occupy.

All this can be communicated to the program by simply indicating the type of the future variable. Having information about the type of a variable, the compiler “understands” how many bytes need to be allocated for it, what actions can be performed with it, and in what constructions it can participate.

For the convenience of programmers, Pascal has many standard data types and, in addition, the ability to create new data types based on existing ones (standard or again defined by the programmer himself), which are called constructed.

The division into basic and constructed data types in Pascal is shown in the table:

Ordinal (discrete) data types

Address data types

Structured Data Types

Arithmetic data types

Basic Data Types

Logical

Symbolic

Real

Netipizi

indexed index

Constructed types

Listable

week = (su, mo, tu, we, th, fr,sa);

Typed pointer

Array

String string

record record

Procedural

Object

Interval (range)

Programmer Constructed Data Types

Ordinal data types

Among the basic data types, ordinal types stand out. This name can be justified in two ways:

1. Each element of an ordinal type can be associated with a unique (ordinal) number. Numbering of values ​​starts from zero. The exception is the shortint, integer and longint data types. Their numbering coincides with the values ​​of the elements.

2. In addition, on elements of any ordinal type, an order is defined (in the mathematical sense of the word), which directly depends on the numbering. Thus, for any two elements of an ordinal type, one can say exactly which of them is smaller and which is larger.

Standard routines that handle ordinal data types

The following functions and procedures are defined only for ordinal types:

1.The ord(x) function returns the ordinal number of the value of the variable x (relative to the type to which the variable x belongs).

2.The function pred(x) returns the value preceding x (not applicable to the first element of the type).

3.The function succ(x) returns the value following x (not applicable to the last element of the type).

4.The procedure inc(x) returns the value following x (for arithmetic data types this is equivalent to the operator x:=x+1).

5.The procedure inc(x,k) returns the kth value following x (for arithmetic data types this is equivalent to the operator x:=x+k).

6.The procedure dec(x) returns the value preceding x (for arithmetic data types this is equivalent to the operator x:=x-1).

7.The procedure dec(x,k) returns the k-e value preceding x (for arithmetic data types this is equivalent to the operator x:=x-k).

At first glance, it appears that the result of using the inc(x) procedure is exactly the same as the result of using the succ(x) function. However, the difference between them appears at the boundaries of the permissible range. The succ(x) function is not applicable to the maximum element of a type, but the inc(x) procedure will not produce any error, but, acting according to the rules of machine addition, will add the next one to the element number. The number, of course, will go outside the range and, due to truncation, will turn into the number of the minimum value of the range. It turns out that the procedures inc() and dec() perceive any ordinal type as if “closed in a ring”: immediately after the last value comes the first value again.

Let us explain everything that has been said with an example. For data type

type sixteen = 0..15;

trying to add 1 to the number 15 will give the following result:

The initial unit will be cut off, and therefore it turns out that inc(15)=0.

A similar situation at the lower limit of the permissible range of an arbitrary ordinal data type is observed for the procedure dec(x) and the function pred(x):

dec(min_element)= max_element

Data types related to ordinal

1. The boolean type has two values: false and true, and the following equalities hold for them:

ord(false)=0, ord(true)=1, false

pred(true)=false, succ(false)=true,

inc(true)=false, inc(false)=true,

dec(true)=false, dec(false)=true.

2. The character type char contains 256 extended ASCII characters (for example, "a", "b", "i", "7", "#"). The character number returned by the ord() function is the same as the character number in the ASCII table.

3. Let's summarize the integer data types in a table:

Data type

Number of bytes

Range

2147483648..2147483647

4. Enumerated data types are specified in the type section by explicitly listing their elements. For example:

type week =(sun,mon,tue,wed,thu,fri,sat)

Recall that for this data type:

inc(sat) = sun, dec(sun) = sat.

5. Interval data types are specified only by the boundaries of their range. For example:

type month = 1..12;

budni = mon..fri;

6. Data types constructed by the programmer are described in the type section according to the following pattern:

type<имя_типа> = <описание_типа>;

For example:

type lat_bukvy = "a".."z","A".."Z";

The basic data types are standard, so there is no need to describe them in the type section. However, if desired, this can also be done, for example, by giving long definitions short names. Let's say by introducing a new data type

type int = integer;

You can shorten the program text a little.

Real data types

Recall that these data types are arithmetic, not ordinal.

Data type

Number of bytes

Range (absolute value)

1.5*10-45..3.4*1038

2.9*10-39..1.7*1038

5.0*10-324..1.7*10308

3.4*10-4932..1.1*104932

Constructed data types

We will consider these data types (along with the operations defined for them) further over the course of several lectures.

Operations and Expressions

Arithmetic operations

Let's talk about operations - standard actions allowed for variables of one or another basic data type. The basis will be arithmetic and logical operations.

Note: All of the operators listed below (except for unary "-" and not) require two operands.

1. Logical operations (and - logical AND, or - logical OR, not - logical NOT, xor - exclusive OR) are applicable only to values ​​of the boolean type. They also result in boolean values. Here are tables of values ​​for these operations:

true false true

false false false

true false false

2. Comparison operations (=,<>, >, <, <=, >=) apply to all basic types. Their results are also boolean values.

3. The operations of integer arithmetic are applicable only to integer types. Their result is an integer whose type depends on the types of the operands.

a div b - division of a by b completely (there is probably no need to remind you that division by 0 is prohibited, so in such cases the operation generates an error). The result will be of a data type common to the types to which the operands belong.

For example, (shortint div byte = integer). This can be explained this way: integer is a minimal type of which both byte and shortint are subsets.

a mod b - taking the remainder when dividing a by b. The type of the result, as in the previous case, is determined by the types of the operands, and 0 is an illegal value for b. Unlike the mathematical operation mod, the result of which is always a non-negative number, the sign of the result of the "programmer" operation mod is determined by the sign of its first operand. Thus, if in mathematics (-2 mod 5) = 3, then we have (-2 mod 5) = -2.

a shl k - shift the value of a by k bits to the left (this is equivalent to multiplying the value of variable a by 2k). The result of the operation will be of the same type as its first operand(s).

a shr k - shifts the value of a by k bits to the right (this is equivalent to dividing the value of the variable a by 2k completely). The result of the operation will be of the same type as its first operand(s).

and, or, not, xor - binary arithmetic operations that work with bits of the binary representation of integers, according to the same rules as the corresponding logical operations.

4. General arithmetic operations (+, -, *, /) apply to all arithmetic types. Their result belongs to a data type common to both operands (the only exception is the fractional division operation /, the result of which is always a real data type).

Other operations

There are other operations that are specific to the values ​​of some of Pascal's standard data types. We will consider these operations in the appropriate sections:

#, in, +, *, : see lecture 5 “Symbols. Lines. Multitudes"

@, ^: see lecture 7 “Addresses and pointers”

Standard arithmetic functions

Arithmetic operations also include standard arithmetic functions. We provide a list of them with a brief description in the table.

Function

Description

Argument type

Result type

Absolute value (modulus) of a number

Arithmetic

Same as argument type

Arctangent (in radians)

Arithmetic

Real

Cosine (in radians)

Arithmetic

Real

Exponent (ex)

Arithmetic

Real

Taking the fractional part of a number

Arithmetic

Real

Taking the whole part of a number

Arithmetic

Real

Natural logarithm (base e)

Arithmetic

Real

Checking if a number is odd

Number meaning

Real

Round to the nearest integer

Arithmetic

Round down - to the nearest smaller integer

Arithmetic

Sine (in radians)

Arithmetic

Real

Squaring

Arithmetic

Real

Square Root

Arithmetic

Real

Arithmetic Expressions

All arithmetic operations can be combined with each other - of course, taking into account the data types allowed for their operands.

The operands of any operation can be variables, constants, function calls, or expressions built on the basis of other operations. All together is called an expression.

Examples of arithmetic expressions:

(x<0) and (y>0) - an expression whose result is of type boolean;

z shl abs(k) - the second operand is a call to the standard function;

(x mod k) + min(a,b) + trunc(z) - a combination of arithmetic operations and function calls;

odd(round(x/abs(x))) - "multi-story" expression.

Calculation order

If the expression contains parentheses, then the calculations are performed in the following order: the smaller the nesting depth of the parentheses, the later the operation enclosed in them is calculated. If there are no parentheses, then the values ​​of operations with a higher priority are calculated first, then those with a lower priority. Several consecutive operations of the same priority are calculated in sequence from left to right.

Table 2.1. Priorities (for all) Pascal operations

Pascal language data types: classification and descriptions. Arithmetic and ordinal data types, actions with them. Arithmetic expressions: functions, operations and order of actions. Data type compatibility and conversions.

Pascal compilers require that information about the amount of memory needed to run a program be provided before it runs. To do this, in the variable description section ( var) you need to list all the variables used in the program. In addition, you also need to tell the compiler how much memory each of these variables will occupy. It would also be nice to agree in advance on the various operations applicable to certain variables...

All this can be communicated to the program by simply indicating the type of the future variable. Having information about the type of a variable, the compiler “understands” how many bytes need to be allocated for it, what actions can be performed with it, and in what constructions it can participate.

For the convenience of programmers, Pascal has many standard data types, plus the ability to create new types.

When constructing new types of data based on existing ones (standard or again defined by the programmer himself), we must remember that any building must be built on a good foundation. Therefore, now we will talk about this “foundation”.

Based basic data types all other types of the Pascal language are built, which are called: constructed.

The division into basic and constructed data types in Pascal is shown in the table:

Programmer-constructed data types are described in section type according to the following template:

type<имя_типа> = <описание_типа>;

For example:

type Lat_Bukvy = "a" .. "z", "A" .. "Z";

The basic data types are standard, so there is no need to describe them in the section type. However, if desired, this can also be done, for example, by giving long definitions short names. Let's say by introducing a new data type

type Int = Integer;

You can shorten the program text a little.

Standard constructed types also need not be described in the section type. However, in some cases this still has to be done due to syntax requirements. For example, in parameter list procedures or functions Type constructors cannot be used (see lecture 8).

Ordinal data types

Among the basic data types, the most notable ones are ordinal types. This name can be justified in two ways:

Standard routines that process ordinal data types

Only for quantities ordinal types The following functions and procedures are defined:

  1. Function Ord(x) returns the ordinal number of the value of the variable x (relative to the type to which the variable x belongs).
  2. Function Pred(x) returns the value preceding x (not applicable to the first element of the type).
  3. Function Succ(x) returns the value following x (not applicable to the last element of the type).
  4. Procedure Inc(x) returns the value following x (for arithmetic data types this is equivalent to the operator x:= x + 1).
  5. Procedure Inc(x, k) returns the kth value following x (for arithmetic data types this is equivalent to the operator x:= x + k).
  6. Procedure Dec(x) returns the value preceding x (for arithmetic data types this is equivalent to the operator x:= x - 1).
  7. Procedure Dec(x, k) returns the k–e value preceding x (for arithmetic data types this is equivalent to the operator x:= x - k).

At first glance, it seems as if the result of applying the procedure Inc(x) completely coincides with the result of applying the function Succ(x). However, the difference between them appears at the boundaries of the permissible range. Function Succ(x) is not applicable to the maximum element of a type, but here is the procedure Inc(x) will not produce any error, but, acting according to the rules of machine addition, will add the next unit to the element number. The number, of course, will go outside the range and, due to truncation, will turn into the number of the minimum value of the range. It turns out that the procedures Inc() And Dec() they perceive any ordinal type as if “closed in a ring”: immediately after the last value comes the first value again.

Let us explain everything that has been said with an example. For data type

type Sixteen = 0 .. 15 ;

trying to add 1 to the number 15 will result in the following result:

1 1 1 1 1 1 0 0 0 0

The initial unit will be cut off, and therefore it turns out that Inc(15)=0 .

A similar situation at the lower limit of the permissible range of an arbitrary ordinal data type is observed for the procedure Dec(x) and functions Pred(x):

Data types related to ordinal

Let us now describe ordinal data types in details.

  1. Boolean type Boolean has two values: False and True, and the following equalities hold for them:
  2. To character type Char includes 256 characters extended ASCII table(for example, "a", "b", "i", "7", "#"). Character number returned by the function Ord() , matches the number of this symbol in ASCII table.
  3. Integer data types Let's put it in a table:
  4. Listable data types are specified in the section type by explicitly listing their elements. For example:

    type Week = (sun, mon, tue, wed, thu, fri, sat); 0 1 2 3 4 5 6

    Recall that for this data type:

  5. Interval data types are specified only by the boundaries of their range. For example:

    type Month = 1 .. 12 ;
    Budni = Mon .. Fri;

  6. The programmer can create his own data types, which are a combination of several standard types. For example:

    type Valid_For_Identifiers = "a" .. "z" , "A" .. "Z" , "_" , "0" .. "9" ;

This type consists of combining several intervals, and in this case the order of the Latin letters is changed: if in the standard type