Pascal programming environment presentation. Programming languageABC Pascal presentation for a lesson on computer science and ICT on the topic. The uses command will open in a separate window.

Slide description:

The Pascal ABC system The Pascal ABC system is designed for teaching programming in the Pascal language and is aimed at schoolchildren and junior students. According to the authors, initial programming training should take place in fairly simple and friendly environments, at the same time, these environments should be close to standard in terms of programming language capabilities and have fairly rich and modern libraries of standard routines. The Pascal language is recognized by many Russian teachers as one of the best for initial learning. However, the Borland Pascal environment, oriented on MS DOS, is outdated, and the Borland Delphi environment, with its rich capabilities, is difficult for a novice programmer. Thus, an attempt to start learning by writing an event program in Borland Delphi causes a lot of difficulties for the student and leads to a number of incorrectly formed skills. The Pascal ABC system is based on the Delphi Pascal language and is designed to make a gradual transition from the simplest programs to modular, object-oriented, event-based and component programming. Some language constructs in Pascal ABC allow, along with the main one, simplified use, which allows them to be used at the early stages of learning. For example, modules may not have an interface section and an implementation section. In this case, the modules are structured in almost the same way as the main program, which allows you to start studying them in parallel with the topic “Procedures and Functions”. Method bodies can be defined directly inside classes (in the style of Java and C#), which allows you to create classes almost immediately after learning the records, procedures and functions. A number of modules of the Pascal ABC programming system were specially created for educational purposes: Module raster graphics GraphABC does without objects, although its capabilities are almost the same as graphic capabilities Borland Delphi. It is available in non-event programs and allows you to easily create flicker-free animations. The Events module allows you to create simple event programs without using objects (events are ordinary procedural variables). The Timers and Sounds modules allow you to create timers and sounds, which are also implemented in a procedural style. These modules can even be used in console programs. The Containers module of container classes allows you to work with basic data structures (dynamic arrays, stacks, queues, sets), implemented as classes. Module vector graphics ABCObjects is designed for quickly learning the basics of object-oriented programming, and also allows you to create quite complex game and educational programs. The VCL Visual Components module allows you to create event-driven applications main form in Delphi style. VCL classes are a bit simplified compared to similar Delphi classes. There is a form editor and an object inspector. The technology for restoring a form using program code makes it possible to use just one file for an application with the main form (!). Pascal ABC has typed pointer arithmetic (C-style) and a complex type for working with complex numbers. The Pascal ABC compiler is a front-end compiler. This means that it does not generate executable code as an .exe file, but rather creates a program tree in memory as a result of compilation, which is then executed using the built-in interpreter. As a result, the speed of the program is approximately 20 times slower than the speed of the same program compiled in the Borland Pascal environment, and 50 times slower than the program compiled in the Borland Delphi environment. In the Pascal ABC system, the student can perform so-called verifiable tasks that ensure the formulation tasks with random initial data, control of input-output operations, checking the correctness of the solution, as well as maintaining a protocol for solving problems. The tasks being checked are implemented in the form of an electronic programming task book, Programming Taskbook, containing 1000 programming tasks of varying levels of complexity (from simple tasks to tasks on files, pointers and recursion) as well as in the form of executors Robot and Draftsman, designed to quickly teach the basics of programming to primary and secondary school students. The freely distributed version of Pascal ABC & Programming Taskbook Mini Edition includes a mini version of the electronic taskbook (200 tasks) and a stripped-down a set of tasks for performers Robot and Draftsman. Pascal ABC & Programming Taskbook Complete Edition contains a complete set of tasks.


Niklaus Wirth In the early 70s of the 20th century, the Swiss scientist Niklaus Wirth developed a programming language and gave it the name Pascal, in honor of the famous French mathematician of the 17th century, the inventor of the first calculating machine, Blaise Pascal. Using Pascal, you can develop programs for a wide variety of purposes. The syntax of this language is intuitive even for those who are just starting to learn the basics of programming.




The alphabet of the language is the uppercase and lowercase letters of the Latin alphabet from A to z, as well as the underscore character (_), which is also considered a letter. Uppercase and lowercase letters are interchangeable (equal meaning); Arabic numerals; special single characters: + – * / =., : ; ^ $ special paired characters: () ( ) ; compound signs: =.. (* *) (..).








Program structure Program NameProgram; (program title) Uses ...; (module connection section) Label ...; (label description section) Const ...; (constant description section) Ture...; (type definition section) Var ...; (variable description section) Function...; Procedure...; (section of descriptions of functions and procedures) BEGIN... (section of statements) END.











Arithmetic operations If you write in the program: Writeln(3+8); Then after executing the program, the message 3+8 will appear in the execution screen. If you write: Writeln(3+8); //without apostrophes Then after executing the program, the inscription 11 will appear in the execution screen, i.e. Pascal will do the calculation itself. Try to calculate the expression: 185(14+16)

Slide 2

Program structure

A Pascal ABC program has the following form: program program name; module connection section description section begin operators end. The first line is called the program header and is optional. The section for connecting modules begins with the service word uses, followed by a list of module names, separated by commas. The description section may include sections describing variables, constants, types, procedures and functions, which follow each other in any order. The module connection section and description section may be missing. Operators are separated from each other by the semicolon character.

Slide 3

program program name;uses module connection sectionvar descriptions sectionbegin operatorsend.

Slide 4

Program - Program; Uses – Use; Var– description; Begin - Beginning; End - The end.

Slide 5

Slide 6

Slide 7

Slide 8

Slide 9

Slide 10

Slide 11

Slide 12

The uses command will open in a separate window.

  • Slide 13

    Let's write our first program: Let's give our program a name, it should be written in Latin letters, and should not start with a number. Each statement ends with - ; Write is a command to output to the viewport.

    Slide 14

    Task 1.

    Let's display the greeting: "Good afternoon." Programpriml; (optional element of the program The name of this program is prim1 (note that the program name must not contain spaces, it must begin with a letter, consist only of Latin letters, numbers and some symbols, dots and commas are not allowed). There is no descriptive part , and immediately there is a section of operators, starting with the service word begin in TurboPascal 7.0, after which comes the language operator)begin (Output the text) writeln("Good afternoon"); (At the end of the program in TurboPascal 7.0 the end operator is required.)end.

    Slide 15

    Program priml; begin writeln("Good afternoon");end.

    Slide 16

    Task 2. Entering the value of the variable N from the keyboard

    programInp; uses Crt; var N: integer; beginClrScr; write("Enter a number from the keyboard:"); readln(N); (Here the program will pause and wait for input from the keyboard. Type a number on the keyboard, for example 153, and press Enter) writeln("You entered a number ", N); readln ( This is the empty input statement. Here the program will pause again and wait for the Enter key to be pressed. During this time, you will have time to view the output on the screen.) end.

    Slide 17

    programInp; usesCrt; var N: integer; beginClrScr; write("Enter a number from the keyboard:"); readln(N); writeln("You entered a number ", N); readlnend.

    Slide 18

    Calculation of body speed when falling from a tower

    Program Piza; const (This is the constants section. It comes before the var section) G=9.8; (The type of a constant is determined automatically, based on the form of the number. In this case, due to the presence of a decimal point, it is a real type) var V,H: real; begin write("Enter the height of the tower:"); readln(H); V:=Sqrt(2*G*H); writeln("Falling speed", V:6:3): (To prevent the text and number from sticking together, a space is added after the text inside the apostrophes) readln end.

    Slide 19

    ProgramPiza; constcrt; G=9.8; var V,H,N:real; begin clrscr; write("Enter tower height:"); readln(H); V:=Sqrt(2*G*H); writeln("Falling speed",V:6:3): readlnend. crt, clrscr; - screen cleaning

    Slide 20

    Slide 21

    Pascal ABC system

    The Pascal ABC system is designed for teaching programming in the Pascal language and is aimed at schoolchildren and junior students. According to the authors, initial programming training should take place in fairly simple and friendly environments, at the same time, these environments should be close to standard in terms of programming language capabilities and have fairly rich and modern libraries of standard routines. The Pascal language is recognized by many Russian teachers as one of the best for initial learning. However, the MS DOS-oriented BorlandPascal environment is outdated, and the BorlandDelphi environment with its rich capabilities is difficult for a novice programmer. Thus, an attempt to start learning by writing an event program in Borland Delphi causes a lot of difficulties for the student and leads to a number of incorrectly formed skills. The Pascal ABC system is based on the DelphiPascal language and is designed to make a gradual transition from the simplest programs to modular, object-oriented, event-based and component programming. Some language constructs in Pascal ABC allow, along with the main one, simplified use, which allows them to be used at the early stages of learning. For example, modules may not have an interface section and an implementation section. In this case, the modules are structured in almost the same way as the main program, which allows you to start studying them in parallel with the topic “Procedures and Functions”. Method bodies can be defined directly inside classes (in the style of Java and C#), which allows you to create classes almost immediately after learning the records, procedures and functions. A number of modules of the Pascal ABC programming system were specially created for educational purposes: The raster graphics module GraphABC does without objects, although its capabilities practically coincide with the graphic capabilities of BorlandDelphi. It is available in non-event programs and allows you to easily create flicker-free animations. The Events module allows you to create simple event programs without using objects (events are ordinary procedural variables). The Timers and Sounds modules allow you to create timers and sounds, which are also implemented in a procedural style. These modules can even be used in console programs. The Containers module of container classes allows you to work with basic data structures (dynamic arrays, stacks, queues, sets), implemented as classes. The ABCObjects vector graphics module is designed for quickly learning the basics of object-oriented programming, and also allows you to create quite complex game and educational programs. The VCL Visual Components module allows you to create event-driven applications with a Delphi-style main form. VCL classes are a bit simplified compared to similar Delphi classes. There is a form editor and an object inspector. The technology for restoring a form using program code makes it possible to use just one file for an application with the main form (!). Pascal's ABC language provides typed pointer arithmetic (C-style) as well as a complex type for working with complex numbers. The Pascal ABC compiler is a front-end compiler. This means that it does not generate executable code as an .exe file, but rather creates a program tree in memory as a result of compilation, which is then executed using the built-in interpreter. As a result, the speed of the program is approximately 20 times slower than the speed of the same program compiled in the BorlandPascal environment, and 50 times slower than the same program compiled in the BorlandDelphi environment. In the Pascal ABC system, a student can perform so-called verifiable tasks, which ensure the formulation of a problem with random initial data, control of input-output operations, verification of the correctness of the solution, as well as maintaining a record of problem solving. The tested tasks are implemented in the form of an electronic programming problem book, ProgrammingTaskbook, containing 1000 programming tasks of varying levels of complexity (from the simplest problems to problems involving files, pointers and recursion) as well as in the form of executors Robot and Draftsman, intended for quickly teaching the basics of programming to junior and high school students. middle classes. The freely distributed version of Pascal ABC & ProgrammingTaskbookMiniEdition includes a mini-version of the electronic problem book (200 tasks) and a stripped-down set of tasks for Robot and Draftsman performers. Pascal ABC & ProgrammingTaskbookCompleteEdition contains a complete set of tasks.

    Slide 1

    Slide 2

    Lesson 1. My first program Our first program will be a greeting program. It will simply display the text on the computer screen and complete its work. We will also look at the basic rules for designing a program. program First; begin write("Hello,"); writeln("friends!"); writeln("This is the second line") end. The first line is the program title. Program is a service word; First is the name of our program, you can come up with it yourself. At the end of the line there is ";" When listing Pascal instructions, you need to put “;” between them. . Next comes the body of the program. It always begins with the word begin. There is no ";" at the end of the line. The following command or statement displays the word HELLO on the screen; The output text is always enclosed in apostrophes. (" "). This operator displays the word FRIENDS on the screen! and moves the cursor to the next line. Because The "ln" characters in the writeln statement mean "line" - a line. Here at the end of the line ";" is not required, because This is the last operator (you don’t have to put “;” before end). End – ends the body of the program and there must be a period at the end. As a result of executing the program we get

    Slide 3

    How to install a program on a computer? First, let's look at the stages that the user (programmer) must go through in order to see the correct results of the program on the screen.

    Slide 4

    Scheme of the stages of creating a program on a computer. start Edit Error? Compile Error? Build Error? Run Error? End Yes Yes Yes Yes No No No No

    Slide 5

    Run the Pascal ABC program from the icon on the desktop Main menu Go to - F10 Edit window Go from the main menu - Alt Output window Start to execute the program - F9

    Slide 6

    Type your first program in the editing window and launch it with the F9 button. program First; begin write("Hello, "); writeln("friends!"); writeln("This is the second line") end. The processes of compiling and launching a program for execution can be combined by calling the Run (F9) command immediately after typing the program text. Exiting the program is done using the Exit command in the File menu. Task 1. Write a program that displays the text on the screen: Important Do not confuse Write and Writeln! Let's check.

    Slide 7

    Task 2. Write a program that displays the phrase “Hello everyone!” 20 times - in a table of 5 rows by 4 columns. Clue. Use multiple spaces to set space between columns. Write only one write statement first? Which will display one phrase (don't forget about spaces). Then copy it 4 more times to get the whole line. At the end, don't forget to add a break to the next line (writeln). No need to copy begin and end! Let's check.