Menu
Is free
check in
the main  /  Multimedia / Programming in the language Pascal School level. Introduction to Pascal Programming Language

Programming in Pascal School level. Introduction to Pascal Programming Language

Perhaps there is not a single modern person who would not know the tongue of Pascal (programming basics). And it is not amazing! Even in the textbook on computer science for schoolchildren, the main concepts of this unique program are painted.

Now, in century information technologiesEveryone can conduct for themselves training on tutorial online (passing courses "Studying programming languages \u200b\u200bfrom scratch"; "Pascal for teapots" and others).

The history of the language studied is not so simple: Pascal has undergone many changes before the schoolchildren saw it in the form in which he was taught in the lessons. It was the very first simple language (ORD Pascal) for programming to help solve many practical tasks of the past century (1970). It was developed by a group of scientists.

With the expansion of platforms, new versions of this program have been created, and Pascal has become a classic programming language.

Below will deal: what is Pascal, what is its main tools. Consider the operations and functions of the program, its specific features. At the examples we will understand how it works. Teach to write and work in Pascal.

What is a programming language Pascal

This is a basic high-level program. It ranks first in the curriculum of many schools and universities of the Russian Federation.

Features of the PascalaBC.net system

Everything is known in comparison, therefore, the advantages of this program will consider in the ratio with another language Basic.

So, what is characteristic of the Pascal language and that is not suitable for Baysika:

  1. First, the presence of a compiler that allows you to download Pascal on any platforms.
  2. Secondly, all versions of this program are compatible with each other.
  3. Thirdly, the structured data types help the programmer accurately make the necessary algorithm for solving a practical task, while protecting it.
  4. Fourth, clarity and logical of the program interface: All commands are simple and understandable.
  5. Fifth, the transition to another, higher programming language, simple enough.

Examples of programs on Pascalabc.net

The sum of the injected integers

The product of integers

How many odd among N introduced

Protection against incorrect entry

Conclusion 10 first degrees of two

Find the amount of numbers of a whole positive number M

Decomposition of a number of simple factors

Pascal for beginners - Basic concepts

We will understand basic conceptshelping to write a program correctly in this language.

Workspace

What does the workspace look like?

Now consider the basis: alphabet and structure.

Alphabet Pascal

What do you need to know? The alphabet is a set of characters required when drawing up a program.

What applies to them:

  1. Latin capital, lowercase letters (A, B, C ... .A, B, C).
  2. Arithmetic symbols (0, 1, 2 ...).
  3. Special signs (punctuation, brackets, quotes, arithmetic signs, etc.).
  4. Indivisible characters (: \u003d, ˃ \u003d ...).
  5. Service words:
  • and - and;
  • array - array;
  • begin - the beginning;
  • do - execute;
  • eLSE - Otherwise;
  • for - for;
  • if - if;
  • of - from;
  • or - or;
  • procedure - procedure;
  • program - program;
  • repeat - repeat;
  • then then;
  • to - up;
  • until - up to (\u003d yet);
  • var - variable;
  • while - so far.

Climb: Constants, operations should not wear the same names as official words (length - any).

Structure of the program

So, what is the "hierarchy" of this program?

By its structure, this language is divided into 3 sections:

  • name;
  • data;
  • actions.

Note: Variables need to be listed through the comma, and after through ":" specify their type. Complete written ";".

Actions start with "Begin" and end "END" with a point.

The structure can be represented as:

By the way, operators are separated by a semicolon.

Write, Writeln, Read, Readln Operators

We find out how the output and input of information occurs.

Output

As such output operators in this language are not, but there are special words that help run the necessary functions. it write, Writeln..

What is their main difference? When entering or displaying subsequent information after them: In the first case, the subsequent information will be displayed on the same line where the operator is written. But in the second - to the next.

Input

For input, there are also their own words: read, readln. (\u003d READKEY).

They differ from each other in the same way as the previous operators (with output).

Whole data type

Allocate 3 main types:

  1. Integer.
  2. Byte.
  3. Longint.

With them also carry out simple actions:

  • addition - "+";
  • subtraction - "-";
  • multiplication - "*";
  • division - "div."

In addition, it is allowed to carry out relations and comparisons (more or equal - ˃ \u003d).

Real data types

Such variables include fractional numbers (for example, the number Pi). Here they are called Real.

What do you need to remember? To introduce a fractional number formula, it is necessary to use a point instead of a comma. To write degrees (x * 10 y) 10, it is replaced with E and the number has an entry:

With them you can perform both the simplest arithmetic actions and more complex:

  • square root - SQRT;
  • absolute value - ABS;
  • quadratic function - SQR;
  • sinus - sin;
  • cosine - COS;
  • arctanens - Arctan;
  • natural logarithm - ln;
  • exhibitor - EXP.

Data processing

In addition to the functions listed above (in the previous 2 points), there are others:

  • a whole part of the number - int;
  • fractional part of the number - FRAC;
  • obtaining a whole part of the number - trunc;
  • rounding to whole - Round;
  • transformation of ordinal type - ORD;
  • code conversion to symbol type - chr;
  • determining the previous value of the value - PRED;
  • determining the subsequent value of the value - SUCC.

Mathematical operations

Mathematical functions and operations were considered when parsing as integers and real data.

Let us dwell on the types of constants and variables. What are they?

Simple includes subtypes:

  • whole - integer;
  • logical - boolean;
  • symbolic - Char;
  • listed;
  • interval;
  • real.

String recorded by the string command. References are represented by the appropriate form.

Structured divided by:

  • arrays - Array;
  • records - Record;
  • sets - set;
  • file file.

For each type, their sets of operations are characteristic.

Conditions

If there are alternative commands and functions, then using IF, THEN, ELSE operators, you can record the necessary commands to solve a practical task.

The scheme is presented in the figure below.

Logical operations

Operations are based on the truth of the fact or lies.

4 types of such functions are distinguished:

  1. ODD - if an odd number, then truth (on the contrary - lie).
  2. Eoln - Truth at the end of the line (elsewhere - lie).
  3. Eof - Truth at the end of the file (elsewhere - lie).

Program management functions

What other procedures exist:

  • Inc is an increase in the number;
  • CLRSCR - cleaning previous results of the program;
  • Uses CRT - Run CLSCR;
  • LENGTH - Return of the length of the line;
  • VAL - Row transformation into numbers;
  • POS - find the first transformation in the line;
  • ASSIGN - binding a variable with a file;
  • Upcase - Translation of lowercase letters in capital.

Conclusion

Thus, to become a good programmer, first need to study the foundation. Pascal for this will be the best choice.

Create the first program in Pascalabc.net. We disassemble the highlights.

Pascalabc.net - School - Simple numbers. Swelto Eratosthen

We disassemble the fastest search algorithm for prime numbers. Swelto Eratosthene. Experiment compared to algorithms. We disassemble several more functions and capabilities of the Pascal language ...

PascalabC.net - School - Compilers (1. Value) - Selection of numbers

We start to understand the compilers. We are looking for in the text of the number of integers and fractional. Follow the updates of this lineup!

Pascalabc.net - School - Compilers (2. Watch allocate) - words and lines

We continue to develop the compiler. Learning to allocate words and lines.

Pascalabc.net - School - solve the task for grade 7

Pascalabc.net - School - ♫ Piano + OOP + Klitschko

We understand how to make a simple piano with the use of OOP (object-oriented programming).

Pascalabc.net - School - 1. Cool Calculator with brackets. Selling expressions

We write a powerful calculator, breaking brackets and functions, such as sin or trunc. OOP (object-oriented programming).

Pascalabc.net - School - 2. Cool Calculator with brackets. Selling expressions

Continued !!! We bring to mind a powerful calculator, breaking brackets and functions, such as sin or trunc. OOP (object-oriented programming).

Pascalabc.net - School - 1. Advanced phone book! Quick search. Indexing

How to implement quick search in a large amount of data. Theory of graphs. Create on the example of a phone book.

Professional development environment for creating programs and applications of any level of complexity. Combines the classic simplicity of Pascal and all the possibilities of the modern development environment .Net, which professional developers use worldwide. In addition, the programming language Pascal is studied at the school course of informatics, giving students basic knowledge about operators and variables. Thus, the training of Pascal ABS is given to beginners better than the development of other programming languages.

The course from the seven practical video clocks is ideal for those who want to learn how to make a program in Pascal ABC, regardless of the level of preparation. Each lesson has its own theme, so they can be viewed both in order, and selectively to deepen and expand their knowledge in a particular area.

Pascal ABC lessons

Pascal ABS lessons presented in the video course are based on the development applied software And give practical knowledge. All programs that you write in the process of passing a video course, fully workers and can be used in everyday life - "Waters" and empty theory are in the course.

We master the editor interface and write your first line of code.


We study the logic of working with numbers and construct the timer.


We study how the programming language compiles the source code.



We use Pascal to find a solution to the task about schoolgirl Anna.


We program a real virtual music synthesizer.


We master complicated mathematical functions and create a full-fledged engineering calculator.



Create a "correct" telephone book based on a database.


Lesson 1 - First Program
Lesson 2 - Simple numbers
Lesson 3 - Compilers (part 1)
Lesson 3 - Compilers (Part 2)
Lesson 4 - Solution School Task
Lesson 5 - Creation of Piano
Lesson 6 - Advanced Calculator (Part 1)
Lesson 6 - Advanced Calculator (Part 2)
Lesson 7 - Comfortable Phonebook (Part 1)
Lesson 7 - Comfortable phone book (part 2)
Lesson 7 - Comfortable Phonebook (Part 3)
Lesson 7 - Comfortable phone book (part 4)
Lesson 8 - work with graphics. Particle system (part 1)
Lesson 8 - work with graphics. Particle system (part 2)
Lesson 8 - work with graphics. Particle system (part 3)
Lesson 8 - work with graphics. Particle system (part 4)

2nd ed. - SPB.: 2011. - 320from.

This book is not a tutorial, but rather an assistant in mastering the programming language Pascal, with which all schoolchildren get acquainted in the informatics lessons. It consists of lessons dedicated to practical issues of programming and solving problems. Numerous examples allow you to better understand how to develop an algorithm, write your own program, correctly arrange its text. Tips and notes help the reader to pay attention to important details, allowing you to avoid underwater stones and more effectively write programs. The book is prepared by teachers of computer science at school, having extensive experience in many years of practical work. In the second edition, several new chapters are added to records, dynamic variables, stack, queues and lists. Also illuminated one of the most difficult topics in programming - the construction of recursive algorithms.

Format: PDF.(2011, 2nd ed., 320c.)

The size: 14.5 MB

Watch, download: docs.google.com.

Content
Preface to the second edition 15
Entry 16.
From publishing house 16.
Topic 1. How to write simple program On Pascal 17.
Lesson 1.1. Display a message on the display screen 18
Lesson 1.2. How to lay this program in computer 19
Stages of creation computer Program 20
Lesson 1.3. Text design on screen 28
Conclusions 34.
Control questions 34.
Topic 2. How to enable Numeric data 36
Lesson 2.1. Let's start with simple: integers 37
The concept of variable 38.
Integer type. Assignment operator. Screen output 38
Integer 40 Operations
Standard Functions such as Integer 42
How variables of the whole type are presented
in computer memory 43
Lesson 2.2. Turn on to work real numbers 45
Description of the real data type (REAL) 45
Recording formats of real variables 46
Real Operations 46.
Standard Real 47 Functions
Recording mathematical expressions 48
How variables of real type are presented in the computer's memory 50
Lesson 2.3. How to combine the variables of the whole and real type 51
Type conversion 51.
The priority rules in the actions performed 52
Actions on data different types 53
Lesson 2.4. Enter and output data 56
Enter variables from the keyboard 57
Beautiful display on screen 57
Setting the values \u200b\u200bof the variable by the sensor of random numbers 61
Lesson 2.5. Why do you need constants in the program? 62.
Conclusions 64.
Control questions 64.
Topic 3. Learning to work with symbols 66
Lesson 3.1. How the computer understands the symbols 67
Code Table ASCII 67
Description CHAR type and standard functions 68
Lesson 3.2. Type char - ordinal type! 70.
Conclusions 71.
Control questions 72.
Topic 4. George Boule and its logic 73
Lesson 4.1. Another type is needed - logical! 74.
Logical data type (Boolean) 75
Relationship operations 75.
Introduction of Boolean variables 76
Lesson 4.2. Logic (Boolean) operations 76
Logical multiplication (conjunction) 76
Logical addition (disjunction) 77
Excluding or (addition by module 2) 77
Logical denial (inversion) 78
Apply logical operations in the program 78
Priority of logical operations 80
Conclusions 81.
Control questions 81.
Topic 5 Analysis of the situation and the sequence of command execution 82
Lesson 5.1. Checking the conditions and branching in the 83 algorithm
Full and incomplete form of operator IF 84
Program design 86.
Lesson 5.2. Blocks of operators 88.
Lesson 5.3. Branching for a number of conditions (CASE operator) 92
Conclusions 96.
Control questions 96.
Topic 6. Multi-repeated actions 98
Lesson 6.1. Operator cycle for 99
Operator for with a sequential increase in the meter 100 Operator for a sequential decrease in counter 101
Lesson 6.2. Application of cycles with a meter 101
Cycle in cycle 102
Tracing 103.
Calculation of the amount of the number of 105
Conclusions 108.
Control questions 109.
Topic 7. Cycles with condition 110
Lesson 7.1. Cycle with precondition 111
Description of the cycle with provant 11
Approximate calculation of the amount of infinite row 112
Erection of the number to the specified whole degree 115
Lesson 7.2. Cycle with post-119
Description of the cycle with post-120
Using Repeat and While 120 cycles
The relativity of the choice of operators of WHILE and REPEAT 123
Conclusions 129.
Control questions 129.
Topic 8. Arrays - Structured Data Type 131
Lesson 8.1. Storage of the same type of data in the form of table 132
Main actions for working with arrays 133
Description of the massif in Pascal 133
Filling an array random numbers and output array on screen 134
Creating a custom data type 137
Search for the maximum array element 140
Calculation of the amount and quantity of array of array with specified properties 144
Lesson 8.2. Search in array 148
Determination of the presence in the array of a negative adherent using the checkbox 148
Determination of the presence in the array of negative atoms by calculating their number 149
Finding the number of negative argent array 150
Lesson 8.3. Two-dimensional arrays 154.
Conclusions 156.
Control questions 157.
Topic 9. Auxiliary algorithms. Procedures and functions. Structural programming 1 58
Lesson 9.1. Construction of the algorithm "top down" 159
Practical task using auxiliary algorithms 160
Lesson 9.2. Example of working with function: Search for the maximum element 167
Conclusions 168.
Control questions 169.
Topic 10. How to work with symbol strings 170
Lesson 10.1. We work with chains of symbols: Type String 171
Description of the string variable 171
Basic actions with strings 172
Lesson 10.2. Some functions and procedures of Pascal to work with strings 173
Using library subroutines for working with strings 173
Conclusions 175.
Control questions 175.
Theme 11. Procedures and functions with parameters 176
Lesson 11.1. Simple examples Use subroutines with parameters 177
The simplest procedures with parameters 177
Formal and actual parameters 179
Simplest features with parameters 179
Lesson 11.2. Methods for transferring parameters 181
Conclusions 183.
Control questions 184.
Topic 12. Files: We Keep the results of the work until next time 185
Lesson 12.1. How to work with text file 186
Opening a read file 186
Opening a file for recording 188
Lesson 12.2. Preservation of a two-dimensional array of numbers in text file 192
Saving numeric data in text file 192
Saving an array of numbers in a text file 192
Add information to the end of the file 196
Conclusions 197.
Control questions 197.
Topic 13. Graphic mode of operation. Module Graph 199.
Lesson 13.1. Turn on graphic mode of operation 200
Features of work with graphics 200
Switching to video adapter 201 graphic mode 201
Lesson 13.2. We continue to study the capabilities of the Graph 203 module
Drawing of lines by means of the Graph 203 module
Drawing Circles Module GRAPH 205
Conclusions 206.
Control questions 207.
Topic 14. Operators changing the natural course of the program 208
Lesson 14.1. Using the operator of the unconditional transition of Goto 210
Lesson 14.2. Operators changing the course of execution of the cycle 213
Operator Break 213.
CONTINUE 214 operator
Conclusions 215.
Control questions 215.
Topic 15. Grouping Data: Records 216
Lesson 15.1. Description of the data type Record 218
Lesson 15.2. When and how wisely use records 220
Creating your own data type - recording 220
Array of records 220.
WITH 221 attachment operator
An example of selecting data structure 223
Recording records 224.
Conclusions 225.
Control questions and tasks 225
Topic 16. Dynamic variables 226
Lesson 16.1. Selecting memory 227.
Lesson 16.2. Addresses 229.
Lesson 16.3. Pointers 230.
Indicators for separate variables 230
Pointers to blocks of variables 232
Lesson 16.4. Dynamic memory allocation 232
NEW and DISPOSE 233
Dynamic memory allocation for arrays 235
GetMem and Freemem 236
Appeal to the elements of an array created by dynamically 237
Array of variable length 238
Conclusions 241.
Control questions 242.
Topic 17. Dynamic data structures. Stack 244.
Lesson 17.1. We describe the data type 245
Lesson 17.2. Creating a stack and basic operations with a stack 247
Adding an item to stack (Push) 248
Extract element from stack (POP) 251
Checking stack on emptiness (stacklsempty) 252
Lesson 17.3. Using stack 253.
Stack programming with array 255
Conclusions 256.
Control questions and tasks 256
Topic 18. Dynamic data structures. Queue 258.
Lesson 18.1. Principle of operation and description of the type of data 259
Lesson 18.2. Basic operations with queue 261
Adding an element in the queue (Enqueue) 261
Extraction of the element from the queue (dequeue) 263
Check queue on void (Queuelsempty) 264
Lesson 18.3. Using the queue 264.
Queue programming with array 267
Conclusions 269.
Control questions 269.
Topic 19. Dynamic data structures. Unidirectional list 270.
Lesson 19.1. Description of the type of data and the principle of operation 271
Lesson 19.2. Basic operations with a unidirectional list 272
Serial View all list items 272
Element room in list 273
Deleting an item from the list 275
Lesson 19.3. Handling lists 276.
Features of using a unidirectional list 278
Conclusions 280.
Control questions 280.
Topic 20. Recursion 281
Lesson 20.1. Description of principle 282.
Lesson 20.2. Khanyan tower 285.
Lesson 20.3. Structure of the recurrent subroutine 287
Lesson 20.4. An example of a recurrent solution of a non-ferrous problem 288
Lesson 20.5. An example of a recurrent solution of the recurrent task 289
Conclusions 291.
Control questions 291.
Appendix 1. Elements of block diagrams 292
Appendix 2. Tasks 295
Integer. Description. Input. Output. Operations 296.
Real. Description. Input. Output. Operations and functions 296
Real. Recording and calculation of expressions 297
Char. Description. Input. Output. Functions 298.
Boolean. Recording expressions 298.
Boolean. Calculation of expressions 299.
IF. Simple comparisons. MIN / MAX / Average 300
IF. Equations and inequalities with parameters 300
For. Listing 300.
For. Calculations with a Cycle Counter 301
For. Bust with comparisons 302
While Repeat. Search 302.
While Repeat. Rows 303.
Graphics. Straight 303.
Graphics. Circle 304.
Arrays. Filling, output, amount / number 305
Arrays. Permutations 305.
Arrays. Search 306.
Arrays. Checks 307.
Arrays. Maxima 307.
Subprograms without parameters 307
Lines. Part I 308.
Lines. Part II 309.
Subprograms with parameters. Part I 309.
Subprograms with parameters. Part II 310.
Subprograms with parameters. Part III 310.
Files 311.
Unidirectional list 312.
Recursion 313.

After the release of the first edition of the book, our colleagues and disciples have become increasingly higher to contact us with a request to supplement the first edition of the information about the most studied and demanded data structures. In this edition, we added several chapters dedicated to entries, dynamic variables, stack, queues and lists. We also tried to highlight one of the most difficult topics in programming - the construction of recursive algorithms.
In the appendix, we decided to abandon the collection of homework with many options on several topics. Instead, we placed a large number of thematic tasks in the application organized by blocks of 5-8 tasks. Tasks in each block are located from simple to complex. We use them at our lessons to organize practical classes when fixing the theoretical material (one occupation is one block).
The authors express their deepest appreciation to one of their best disciples, associate professor of security department information systems SPBGUAP, k. T. N. Evgeny Mikhailovich Linsky for support, many useful Soviets And great help when working on the second edition of the book.

This book is not a tutorial, but rather an assistant in mastering the programming language Pascal, with which all schoolchildren get acquainted in the informatics lessons. It consists of conversations devoted to practical issues of programming and solving problems. Numerous examples allow you to better understand how to develop an algorithm, write your own program, correctly arrange its text. Tips and notes pay attention to readers on important details, allow you to avoid underwater stones, more effectively write programs.
The book is written by school teachers of informatics, having extensive experience of many years of practical work.

What is a programming language? Any task that the computer solves is written in the form of a command sequence. Such a sequence is called a program. Commands, of course, should be represented in the language, understandable computer. One of these languages \u200b\u200bis Pascal programming language. It was developed by the Swiss Professor Niko Laus Virgin specifically for learning students programming. The characteristics of the language also include its structure. That is, the program is easily divided into simpler, non-cycle blocks, those, in turn, are even simpler blocks. It also facilitates programming. In 1979, the language was approved as standard. Wirth called him in honor of the French Scientist Blusa Pascal, the inventor of the counting machine. Language Pascal is simple, logical and effective. He got distribution all over the world. Our conversations are built on specific examples of programs. There are no long theoretical explanations, so it is imperative to carefully read comments in the texts of the programs!
So, we start the first conversation immediately from the first program on Pascal;

Content
Entry 7.
Gratitude 7.
From publishing house 8.
Topic 1. How to write a simple program on Pascal 9
Lesson 1.1. Display a message on the display screen 10
Lesson 1.2. How to lay this program to the computer? eleven
Stages of creating a computer program 12
1. Running Wednesday Pascal 14
2. Operation in Edit Edit 16
3. Saving a program in a disk file 19
4. Running compiler 20
5. Program execution 21
6. Viewing the results of the program 21
7. Exit from Wednesday Pascal 22
Lesson 1.3. Decor text on screen 22
Conclusions 28.
Control questions 28.
Topic 2. How to enable Numeric data 30
Lesson 2.1. Let's start with simple: integers 31
The concept of variable 32.
Integer type. Assignment operator. Display on screen 32
Integer 34 Operations
Standard Functions such as Integer 36
How variables are used in the computer's memory 38
Lesson 2.2. Include real numbers 39
Description of the real type of data (REAL) 40
Recruitment formats of real variables 40
Real Operations 41.
Standard Real 41 Functions
Recording mathematical expressions 43
How variables of real-type variables are in memory
computer 45.
Lesson 2.3. How to combine variable integer and real type 46
Type conversion 46.
Priority rules in the actions performed 47
Actions applied different types 47
Lesson 2.4. Enter and output data 51
Enter variables from the keyboard 52
Beautiful output on screen 52
Setting values \u200b\u200bof variable sensor by random numbers 55
Lesson 2.5. Why do you need constants in the program? 57.
Conclusions 59.
Control questions 60.
Topic 3. Learning to work with symbols 61
Lesson 3.1. How the computer understands the symbols 62
Code Table ASCII 62
Description CHAR type and standard functions 63
Lesson 3.2. Type char - ordinal type! 64.
Conclusions 66.
Control questions 67.
Topic 4. George Boule and its logic 68
Lesson 4.1. Another type is needed - logical! 69.
Logic data type (Boolean) 70
Relationship operations 70
Introduction of Boolean variables 71
Lesson 4.2. Logic (Boolean) operations 71
Logical multiplication (conjunction) 72
Logical addition (disjunction) 72
Excluding or (addition by module 2) 73
Logical denial (inversion) 74
Application of logical operations in the program 74
Priority of logical operations 76
Conclusions 77.
Control questions 78.
Topic 5 Analysis of the situation and the sequence of execution of commands 79
Lesson 5.1. Checking the conditions and branching in the algorithm 80
Full and incomplete form of operator IF 81
Program design 84.
Lesson 5.2. Blocks of operators 85.
Lesson 5.3. Branching for a number of conditions (CASE operator) 90
Conclusions 94.
Control questions 95.
Topic 6. Multiple repetitive actions 96
Lesson 6.1. Operator-cycle for 97
Operator for a consistent increase in the meter 97
Operator for with a consistent decrease in the meter 99
Lesson 6.2. Application of cycles with a meter 99
Cycle in cycle 100
Tracing 101.
Calculation of the amount of the number of 103
Conclusions 107.
Control questions 108.
Topic 7. Cycles with condition 109
Lesson 7.1. Cycle with precondition 110
Description of the cycle with precondition 110
Approximate calculation of the amount of infinite row 111
The introduction of the number to the specified whole degree 114
Lesson 7.2. Cycle with postband 118
Description of the cycle with postcondition 119
Using Repeat and While 119 cycles
The relativity of the choice of operators of WHILE and REPEAT 123
Conclusions 129.
Control questions 129.
Topic 8. Arrays - Structured Data Type 131
Lesson 8.1. Storage of the same type of data in the form of table 132
Main actions for working with arrays 133
Description of the massif in Pascal 133
Filling an array random numbers and output array on screen 134
Creating a custom data type 137
Search for the maximum element of the array 141
Calculation of the amount and quantity of array elements with specified properties 146
Lesson 8.2. Search in array 148
Determination of the presence in the array of the negative element using the checkbox 149
Determining the presence of negative elements in an array by calculating their number 150
Finding the number of negative element of the array 152
Lesson 8.3. Two-dimensional arrays 156.
Conclusions 158.
Control questions 159.
Topic 9. Auxiliary algorithms. Procedures and functions. Structural programming 160.
Lesson 9.1. Construction of the algorithm "top down" 161
Practical task using auxiliary algorithms 162
Lesson 9.2. Example of working with function: search for the maximum element 169
Conclusions 171.
Control questions 171.
Topic 10. How to work with symbol strings 1 72
Lesson 10.1. We work with chains of symbols: String type 1 73
Description of the string variable 173
Basic actions with strings 174
Lesson 10.2. Some functions and procedures of Pascal to work with strings 175
Using library subroutines for working with strings 175
Conclusions 177.
Control questions 178.
Topic 11. Procedures and functions with parameters 179
Lesson 11.1. Simple examples of using subroutines with parameters 180
Simplest procedures with parameters 180
Formal and actual parameters 182
Simplest features with parameters 183
Lesson 11.2. Methods for transferring parameters 184
Conclusions 187.
Control questions 187.
Topic 12. Files: Keep the results of the work until next time 189
Lesson 12.1. How to work with a text file 190
Opening a Reading File 190
Opening a file for recording 193
Lesson 12.2. Saving a two-dimensional array of numbers in a text file 196
Saving numeric data in text file 196
Saving an array of numbers in a text file 197
Add information to the end of the file 201
Conclusions 202.
Control questions 203.
Topic 13. Graphic mode of operation. Module GRAPH 204.
Lesson 13.1. Turn on graphic mode of operation 205
Features of work with graphics 205
Switching to video adapter 206 graphic mode
Lesson 13.2. We continue to study the capabilities of the Graph 208 module
Drawing Lines of Module Graph 209
Drawing Circles Module Module GRAPH 210
Conclusions 212.
Control questions 212.
Topic 14. Operators changing the natural course of the program 213
Lesson 14.1. Using the unconditional transition of Goto 215
Lesson 14.2. Operators changing the course of execution of the cycle 218
Operator Break 2.19.
Operator Continue 220.
Conclusions 220.
Control issues 221.
Appendix 1. Flowcharts 222
Appendix 2. Homework 224
Tasks for chapter 2 224
Tasks for chapter 4 227
Tasks to chapters 6-7 229
Tasks for chapter 8 236
Alphabetical pointer 254.