
Course Notes For PASCAL Advanced Level © mario camilleri 1990 - 1995 Table of Contents 1. Using the Network ............................................................................. 5 1.1. The Network...............................................................................................................5 1.2. Getting Started ...........................................................................................................5 1.3. Your home directory...................................................................................................6 1.4. Running programs......................................................................................................6 2. MSDOS ............................................................................................... 7 2.1. Listing the contents of a disk ......................................................................................7 2.2. Directory structure......................................................................................................7 2.3. Directory and filenames..............................................................................................8 2.4. Reserved and other extensions ....................................................................................8 2.5. The directory tree........................................................................................................8 2.6. Pathnames ..................................................................................................................9 2.7. Relative pathnames.....................................................................................................9 2.8. Moving about the directory tree ..................................................................................9 2.9. Creating and deleting directories ................................................................................10 2.10.Wildcards ...................................................................................................................10 2.11.Command-line switches..............................................................................................11 2.12.Output redirection.......................................................................................................11 2.13.Copying files ..............................................................................................................12 2.14.Other common MSDOS commands ............................................................................12 3. Using the IDE ..................................................................................... 13 3.1. Running Turbo Pascal.................................................................................................13 3.2. The Turbo Pascal Environment...................................................................................13 3.3. Using the Menus.........................................................................................................14 3.4. Using the Online Help ................................................................................................15 3.5. Loading and Saving Files............................................................................................15 3.6. Compiling a Program .................................................................................................15 3.7. Running Programs......................................................................................................16 3.8. Editing Source Code ...................................................................................................17 3.9. Tracing a Program......................................................................................................17 4. The Structure of a PASCAL Program............................................... 18 4.1. Example of a Simple PASCAL Program.....................................................................18 4.2. Structure of a PASCAL Program ................................................................................20 4.3. Data Output: WRITE and WRITELN ........................................................................20 4.4. Formatted Output........................................................................................................20 4.5. Data Input: READ and READLN ...............................................................................21 4.6. The Assignment Statement .........................................................................................21 4.7. Arithmetic Operators and Functions ...........................................................................21 4.8. Exercises - 1 ...............................................................................................................23 4.9. Exercises - 2 ...............................................................................................................23 5. Conditional and Compound Statements ......................................... 25 5.1. Boolean Values and Relational Operators ...................................................................25 5.2. Logic Operators ..........................................................................................................25 5.3. Boolean Variables.......................................................................................................26 5.4. IF...THEN...ELSE ......................................................................................................27 5.5. Compound Statements ................................................................................................27 5.6. Exercises - If..Then..Else ............................................................................................28 6. The CASE Statement......................................................................... 30 6.1. Syntax of the CASE Statement....................................................................................30 6.2. Using Many Labels In A Single Case..........................................................................31 6.3. Simple Menus.............................................................................................................31 6.4. Exercises ....................................................................................................................32 7. Arrays and Loops .............................................................................. 33 7.1. Single Dimensional Arrays .........................................................................................33 7.2. Two Dimensional Arrays ............................................................................................34 7.3. Higher Dimensional Arrays ........................................................................................34 7.4. Exercises - Arrays.......................................................................................................34 7.5. Loops..........................................................................................................................35 7.6. The FOR..DO loop......................................................................................................35 7.7. The REPEAT..UNTIL loop.........................................................................................37 7.8. The WHILE..DO loop.................................................................................................37 7.9. Comparison of REPEAT..UNTIL and WHILE..DO loops ...........................................38 7.10.Exercises - FOR, REPEAT and WHILE loops.............................................................38 8. Strings and Text Files ....................................................................... 41 8.1. String Variables..........................................................................................................41 8.2. Operations On Strings ................................................................................................41 8.3. Reading and Writing Characters in a String................................................................42 8.4. Comparing Strings......................................................................................................42 8.5. Text Files....................................................................................................................43 8.6. File Variables .............................................................................................................43 8.7. Reading From a Text File ...........................................................................................43 8.8. Creating a New Text File............................................................................................44 8.9. Appending Data to a Text File....................................................................................44 8.10.The Printer Text File ..................................................................................................44 8.11.Exercises - Text Files..................................................................................................45 9. Procedures - 1.................................................................................... 47 9.1. Top-Down Design.......................................................................................................47 9.2. Simple Procedures ......................................................................................................47 9.3. Procedures and the Stack ............................................................................................48
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages79 Page
-
File Size-