pascal programming session 1
TRANSCRIPT
![Page 1: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/1.jpg)
Pascal Programming
http://ashesh.ramjeeawon.infoManagement Student/ Freelance DeveloperUniversity of Mauritius
Module Pre-Requisites:
Problem-Solving Techniques
Session 1: Pascal Fundamentals
![Page 2: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/2.jpg)
Pascal Programming
Today’s Session
1. Intro to Pascal
2. History of Pascal
3. Getting the tools (IDE/Compiler)
4. The basic structure of a Pascal Program
5. Identifiers
6. Data Types
7. Input and Output
![Page 3: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/3.jpg)
Pascal Programming
Intro to Pascal
Pascal is a general-purpose, high-level programming language
Derived from Algol-60
Specifically designed to encourage the use of Structured Programming
![Page 4: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/4.jpg)
Pascal Programming
Intro to Pascal
Pascal was named in honour of Blaise Pascal (1623 – 1662)
Brilliant French Scientist and Mathematician Invented the word’s first calculating machine (Pascaline)
![Page 5: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/5.jpg)
Pascal Programming
History of Pascal
Developed in the early 1970s by Niklaus Wirth at
The Technical University in Zurich, Switzerland
![Page 6: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/6.jpg)
Pascal Programming
History of Pascal
In 1983, Borland International began marketing of an inexpensive compiler called Turbo Pascal.
![Page 7: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/7.jpg)
Pascal Programming
Getting the tools
![Page 8: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/8.jpg)
Pascal Programming
Getting the tools
Turbo Pascal for WindowsGetting hands dirty with the IDEInstalling the Turbo PascalCode writing aidsCompiling DebuggingSaving source code - .pas formatCVS
![Page 9: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/9.jpg)
Pascal Programming
The basic structure of a Pascal Program
PROGRAM ProgramName (FileList);
CONST (* Constant declarations *)
TYPE (* Type declarations *)
VAR (* Variable declarations *)
(* Subprogram definitions *)
BEGIN (* Executable statements *)END.
![Page 10: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/10.jpg)
Pascal Programming
Exercise Time
1. Open your IDE2. Create a complete “dummy” program3. Then save it on your desktop as4. Alpha.pas5. Note: No compilation is required6. Aim 1: to get hands dirty with the IDE 7. Aim 2: understand the structure of a
Pascal Program
![Page 11: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/11.jpg)
Pascal Programming
Identifiers
Must begin with a letter from the English alphabet.
Can be followed by alphanumeric characters (alphabetic characters and numerals) and possibly the underscore (_).
May not contain certain special characters, many of which have special meanings in Pascal.~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? , . / |
![Page 12: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/12.jpg)
Pascal Programming
Identifiers
![Page 13: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/13.jpg)
Pascal Programming
Pascal is not case sensitive!
Turbo Pascal allows you to write names with upper and lowercase letters.
PART_NUMBER part_number PaRt_NumBer Part_Number
Pascal would consider the above identifiers as the same.
![Page 14: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/14.jpg)
Pascal Programming
Memory storage
![Page 15: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/15.jpg)
Pascal Programming
Pascal Data Types
The basic data types in Pascal include:integerrealcharBoolean
![Page 16: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/16.jpg)
Pascal Programming
Pascal Data Types
More: http://www.geocities.com/hotdogcom/ptutor/chap03.html
![Page 17: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/17.jpg)
Pascal Programming
Variable declaration
var IdentifierList1 : DataType1; IdentifierList2 : DataType2; IdentifierList3 : DataType3; ...
var age, year, grade : integer; circumference : real; LetterGrade : char; DidYouFail : Boolean;
![Page 18: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/18.jpg)
Pascal Programming
Input and Output
Input from keyboardReadln(var);
Output to screenWriteln(‘Hello World!’);
![Page 19: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/19.jpg)
Pascal Programming
The End – Thank you for your kind attention
References:http://taoyue.com/tutorials/pascal/contents.htmlB. Gottfried, Programming with Pascal, 2nd
Edition, McGrawHill
![Page 20: Pascal Programming Session 1](https://reader035.vdocuments.net/reader035/viewer/2022081502/555e01bcd8b42ae4628b549c/html5/thumbnails/20.jpg)
Pascal Programming
http://ashesh.ramjeeawon.infoBlog: http://asheshr.wordpress.comManagement Student/ Freelance DeveloperUniversity of MauritiusBCS Student Member