Pascal, teaspoon No. 0
The contingent of Habrahabr is very diverse. And as statistics say, it is divided into many layers. Here everyone can find information for their "taste and color." But not all of them are great programmers, IT industry experts or just crazy geeks.
As a lyceum student, an 11th grade student, I would like to contribute to the advancement of the process of learning programming languages.
In the CIS countries, Pascal, and its fundamentals, are most often taught in a school course. I studied it myself, and was glad of it. But not all schools (lyceums, technical schools) have the opportunity to give deep knowledge and sometimes you have to learn yourself. As for me, school olympiads are a good practice. I wanted to talk about this and much more.
It seems to me that you should start by studying the environment itself. In schools, you do not often see decent equipment on which you can use “sophisticated” development environments and, as a rule, Turbo Pascal 7.1 , TP FOR WINDOWS and many similar environments are used for Pascal .
Download, unpack, our turbo.exe, run. Doesn't start, incompatibility with a 32-bit system? (users of Windows XP, Vista will understand). To make it work you should create a * .bat file, and change it with a regular notepad by writing inside “turbo.exe”. (if absolutely laziness - tp.bat. Put in ... \ TURBO PASCAL 7.1 \ BIN).
If everything is okay then we will see this:
There are many textbooks on the network devoted to the study of this language. They are not difficult to find in electronic form, but I would advise you to buy at least one book for home use and use it as a dictionary (often something will fly out of my head, open, peep, then work further).
I would recommend:
Here are some interesting resources:
As the name suggests, this is a development environment for the Pascal programming language. The compiler component Turbo Pascal was based on the Blue Label Pascal compiler, originally created in 1981 by Anders Halesberg for the NasSys microcomputer Nascom operating system. It was later rewritten as Compass Pascal for the CP / M operating system, then as Turbo Pascal for DOS and CP / M. One version of Turbo Pascal was available under the Apple Macintosh since about 1986, but its development ceased around 1992.
When the first version of Turbo Pascal appeared in 1983, this type of development environment was relatively new. During its debut in the US market, Turbo Pascal was priced at $ 49.99. In addition to the attractive price, Pascal's built-in compiler was also of very high quality. The “Turbo” prefix hinted at both compilation speed and the speed of the executable code it produces.
For that time, it was an amazing development environment. It was simple and intuitive, with a well-organized menu. Earlier versions used the WordStar keyboard shortcut. In later versions, it became possible to quickly get the definition of a language keyword by simply placing the cursor on the keyword and pressing the help key. Help articles often included examples of code using this keyword. This allowed inexperienced programmers to learn Pascal even without the help of books, using only the development environment.
The environment made it easy to embed assembly language code in Pascal code. The user had the opportunity to go through the program step by step; when switching to assembly block, this also worked. At any time, the user could add a variable or register to a conveniently located window to observe them. During line-by-line debugging of programs using the graphic modes of IBM PC, the correct switching occurred between the graphic mode of the program and the text mode of the development environment.
In addition to all this, there was a profiling tool. The books included with Borland Pascal provided a detailed description of Intel's assembly language, including the number of clock cycles required to complete each instruction. In general, the system provided excellent opportunities for code optimization; the user was not required to use anything other than the development environment. Everything was done so perfectly that even a student could use it.
Since the early 1990s, TP / BP has been used at universities to learn fundamental programming concepts.
Probably, the development of Microsoft Pascal was discontinued due to competition with the high quality and price of Turbo Pascal. Another version says that Borland has entered into an agreement with Microsoft to discontinue development of Turbo BASIC (a development environment for BASIC, a branch of Turbo Pascal) if Microsoft discontinues development of Microsoft Pascal. For a while, Microsoft released QuickPascal, which was almost 100% compatible with Turbo Pascal.
For several years, Borland has improved not only the development environment, but also the language. In version 5.5, it introduced the advanced features of object-oriented programming. The latest released version was version 7. Borland Pascal 7 included a development environment and compilers for creating programs for DOS, extended DOS, and Windows 3.x, while Turbo Pascal 7 could only create regular DOS programs.
Since 1995, Borland discontinued development of Turbo Pascal and proposed as a replacement the Delphi development environment, which includes the Object Pascal programming language.
And now together we’ll try to write the first program.
Our program will display to everyone a painfully well-known phrase.
Press Ctrl + F9 and here is the result of our work:
I believe that anyone who wants to learn how to program should start small, don’t grab on drops, buckets, and so on, which we saw on Habré, especially a schoolboy. At one time, I regretted that teaching C began only at the end of the 10th grade, and we studied Pascal in grades 9-10, but as it turned out, now it’s easier for me to understand the syntax of other languages, I quickly grasp it, understanding the basics. I think that I was able to intrigue future "programmers", and they learned something.
Thanks for attention.
UPD Thanks for the lost karma! After this, I don’t want to write, because you’re afraid that a crowd of idiots will come and wander.
As a lyceum student, an 11th grade student, I would like to contribute to the advancement of the process of learning programming languages.
In the CIS countries, Pascal, and its fundamentals, are most often taught in a school course. I studied it myself, and was glad of it. But not all schools (lyceums, technical schools) have the opportunity to give deep knowledge and sometimes you have to learn yourself. As for me, school olympiads are a good practice. I wanted to talk about this and much more.
Where to begin?
It seems to me that you should start by studying the environment itself. In schools, you do not often see decent equipment on which you can use “sophisticated” development environments and, as a rule, Turbo Pascal 7.1 , TP FOR WINDOWS and many similar environments are used for Pascal .
Download, unpack, our turbo.exe, run. Doesn't start, incompatibility with a 32-bit system? (users of Windows XP, Vista will understand). To make it work you should create a * .bat file, and change it with a regular notepad by writing inside “turbo.exe”. (if absolutely laziness - tp.bat. Put in ... \ TURBO PASCAL 7.1 \ BIN).
If everything is okay then we will see this:
What to do next?
There are many textbooks on the network devoted to the study of this language. They are not difficult to find in electronic form, but I would advise you to buy at least one book for home use and use it as a dictionary (often something will fly out of my head, open, peep, then work further).
I would recommend:
- Yu.A. Shpak. Turbo Pascal 7.0 for examples or here
- V.V. Faronov. Turbo Pascal 7.0 Basic Course
Here are some interesting resources:
- Moscow distance seminars in preparation for the Olympics in computer science.
- Timus Online Judge - archive of tasks with a validation system.
A little history and let's get started
As the name suggests, this is a development environment for the Pascal programming language. The compiler component Turbo Pascal was based on the Blue Label Pascal compiler, originally created in 1981 by Anders Halesberg for the NasSys microcomputer Nascom operating system. It was later rewritten as Compass Pascal for the CP / M operating system, then as Turbo Pascal for DOS and CP / M. One version of Turbo Pascal was available under the Apple Macintosh since about 1986, but its development ceased around 1992.
When the first version of Turbo Pascal appeared in 1983, this type of development environment was relatively new. During its debut in the US market, Turbo Pascal was priced at $ 49.99. In addition to the attractive price, Pascal's built-in compiler was also of very high quality. The “Turbo” prefix hinted at both compilation speed and the speed of the executable code it produces.
For that time, it was an amazing development environment. It was simple and intuitive, with a well-organized menu. Earlier versions used the WordStar keyboard shortcut. In later versions, it became possible to quickly get the definition of a language keyword by simply placing the cursor on the keyword and pressing the help key. Help articles often included examples of code using this keyword. This allowed inexperienced programmers to learn Pascal even without the help of books, using only the development environment.
The environment made it easy to embed assembly language code in Pascal code. The user had the opportunity to go through the program step by step; when switching to assembly block, this also worked. At any time, the user could add a variable or register to a conveniently located window to observe them. During line-by-line debugging of programs using the graphic modes of IBM PC, the correct switching occurred between the graphic mode of the program and the text mode of the development environment.
In addition to all this, there was a profiling tool. The books included with Borland Pascal provided a detailed description of Intel's assembly language, including the number of clock cycles required to complete each instruction. In general, the system provided excellent opportunities for code optimization; the user was not required to use anything other than the development environment. Everything was done so perfectly that even a student could use it.
Since the early 1990s, TP / BP has been used at universities to learn fundamental programming concepts.
Probably, the development of Microsoft Pascal was discontinued due to competition with the high quality and price of Turbo Pascal. Another version says that Borland has entered into an agreement with Microsoft to discontinue development of Turbo BASIC (a development environment for BASIC, a branch of Turbo Pascal) if Microsoft discontinues development of Microsoft Pascal. For a while, Microsoft released QuickPascal, which was almost 100% compatible with Turbo Pascal.
For several years, Borland has improved not only the development environment, but also the language. In version 5.5, it introduced the advanced features of object-oriented programming. The latest released version was version 7. Borland Pascal 7 included a development environment and compilers for creating programs for DOS, extended DOS, and Windows 3.x, while Turbo Pascal 7 could only create regular DOS programs.
Since 1995, Borland discontinued development of Turbo Pascal and proposed as a replacement the Delphi development environment, which includes the Object Pascal programming language.
Without breaking tradition
And now together we’ll try to write the first program.
Our program will display to everyone a painfully well-known phrase.
Program Xabr; {заголовок программы - необязательный компонент}
Uses CRT; {стандартная библиотека, см. ниже }
Begin {операторные скобки}
ClrScr;{ очистка экрана, использует библиотеку СRT}
Writeln('Hello XabraXabr!'); { вывод строки с переводом указателся на следующую}
end. {операторные скобки}
* This source code was highlighted with Source Code Highlighter.
Press Ctrl + F9 and here is the result of our work:
What did we do today?
I believe that anyone who wants to learn how to program should start small, don’t grab on drops, buckets, and so on, which we saw on Habré, especially a schoolboy. At one time, I regretted that teaching C began only at the end of the 10th grade, and we studied Pascal in grades 9-10, but as it turned out, now it’s easier for me to understand the syntax of other languages, I quickly grasp it, understanding the basics. I think that I was able to intrigue future "programmers", and they learned something.
Thanks for attention.
UPD Thanks for the lost karma! After this, I don’t want to write, because you’re afraid that a crowd of idiots will come and wander.