CORONADO ENTERPRISES TURBO PASCAL TUTOR - Version 2.4 This documentation and the accompanying software, including all of the example Pascal programs and text files, are protected under United States copyright law to protect them from unauth- orized commercialization. This version of the tutorial is dis- tributed under the shareware concept, which means you are not required to pay for it. You are permitted to copy the disks, and pass the copies on to a friend, provided that you do not modify any files or omit any files from the complete package, and you are in fact encouraged to pass on complete copies to friends. You are permitted to charge a small fee to cover the costs of duplication, but you are not permitted to charge any- thing for the software itself. If you find the tutorial helpful, you are encouraged to register with the author and to submit a small fee to help compensate him for his time and expense in writing it. We will provide you with a beautifully printed copy of this tutorial if you submit a full registration. See the READ.ME file on either diskette for additional details. Whether or not you send a registration fee, feel free to request a copy of the latest list of available tutorials and a list of the authorized Public Domain libraries that distribute our full line of programming language tutorials. Gordon Dodrill - Dec 1, 1989 Copyright (c) 1988, 1989 Coronado Enterprises Coronado Enterprises 12501 Coronado Ave NE Albuquerque, New Mexico 87122 TURBO PASCAL TUTORIAL - TABLE OF CONTENTS Introduction to the TURBO Pascal tutorial Page I-1 Chapter 1 - What is a computer program? Page 1-1 Chapter 2 - Getting started in Pascal. Page 2-1 TRIVIAL.PAS The minimum Pascal program. 2-1 WRITESM.PAS Write something out. 2-3 WRITEMR.PAS Write more out. 2-4 PASCOMS.PAS Pascal comments illustration. 2-4 GOODFORM.PAS Good formatting example. 2-6 UGLYFORM.PAS Ugly formatting example. 2-6 Chapter 3 - The simple Pascal data types. Page 3-1 INTVAR.PAS Integer variables. 3-2 INTVAR2.PAS More integer variables. 3-3 ALLVAR.PAS All simple variable types. 3-4 REALMATH.PAS Real variable math example. 3-4 INTMATH.PAS Integer variable math example. 3-4 BOOLMATH.PAS Boolean variable math example. 3-5 CHARDEMO.PAS Character variable demonstration. 3-6 CONVERT.PAS Data type conversion. 3-7 NEWINT4.PAS New integer types, ver 4.0 & 5.x 3-7 NEWREAL4.PAS New real types, ver 4.0 & 5.x 3-8 Chapter 4 - Pascal loops and control structures. Page 4-1 LOOPDEMO.PAS Loop demonstration. 4-1 IFDEMO.PAS Conditional branching. 4-2 LOOPIF.PAS Loops and If's together. 4-3 TEMPCONV.PAS Temperature conversion. 4-4 DUMBCONV.PAS Poor variable names. 4-4 REPEATLP.PAS Repeat until structure. 4-4 WHILELP.PAS While structure. 4-5 CASEDEMO.PAS Case demonstration. 4-5 BIGCASE.PAS Bigger case example 4-6 Chapter 5 - Pascal procedures and functions. Page 5-1 PROCED1.PAS Simple procedures. 5-1 PROCED2.PAS Procedures with variables. 5-4 PROCED3.PAS Multiple variables. 5-6 PROCED4.PAS Scope of variables. 5-7 PROCED5.PAS Procedure calling procedures. 5-8 FUNCTION.PAS An example function. 5-8 RECURSON.PAS An example with recursion. 5-9 FORWARD.PAS The forward reference. 5-10 PROCTYPE.PAS The procedure type 5-10 FUNCTYPE.PAS The function type 5-11 Chapter 6 - Arrays, types, constants, & labels. Page 6-1 ARRAYS.PAS Simple arrays. 6-1 ARRAYS2.PAS Multiple arrays. 6-2 TYPES.PAS Example of types. 6-3 CONSTANT.PAS Example of constants. 6-5 LABELS.PAS Label illustration. 6-6 Chapter 7 - Strings and string procedures. Page 7-1 STRARRAY.PAS Pascal strings. 7-1 STRINGS.PAS TURBO Pascal strings. 7-2 WHATSTRG.PAS What is a string? 7-2 Chapter 8 - Scalars, subranges, and sets. Page 8-1 ENTYPES.PAS Enumerated types. 8-1 SUBRANGE.PAS Scaler operations. 8-2 SETS.PAS Set operations. 8-4 FINDCHRS.PAS Search for characters. 8-5 Chapter 9 - Records. Page 9-1 SMALLREC.PAS A small record example. 9-1 BIGREC.PAS A large record example. 9-2 VARREC.PAS A variant record example. 9-5 Chapter 10 - Standard Input/Output. Page 10-1 WRITELNX.PAS Generalized output statements. 10-1 READINT.PAS Read integers from keyboard. 10-2 READREAL.PAS Read reals from keyboard. 10-3 READCHAR.PAS Read characters from keyboard. 10-4 READARRY.PAS Read an array from keyboard. 10-4 READSTRG.PAS Read a string from keyboard. 10-4 PRINTOUT.PAS Print some data on the printer. 10-5 Chapter 11 - Files. Page 11-1 READFILE.PAS Read and display this file. 11-2 READDISP.PAS Read and display any file. 11-3 READSTOR.PAS Read and store any file. 11-4 READINTS.PAS Read an integer data file. 11-6 INTDATA.TXT Integer data file. 11-6 READDATA.PAS Read a mixed data file. 11-7 REALDATA.TXT Real data file. 11-8 BINOUT.PAS Write a binary file. 11-8 BININ.PAS Read a binary file. 11-10 Chapter 12 - Pointers and dynamic allocation. Page 12-1 POINT.PAS First pointer example 12-1 POINT4.PAS Pointers with ver 4.0 & 5.x 12-3 POINTERS.PAS Example program with pointers. 12-3 DYNREC.PAS Dynamic record allocation. 12-5 LINKLIST.PAS An example linked list. 12-7 Chapter 13 - Units in TURBO Pascal 4.0 & 5.x Page 13-1 AREAS.PAS Areas of geometric shapes. 13-1 PERIMS.PAS Perimeters of geometric shapes. 13-4 GARDEN.PAS User of above units. 13-4 SHAPES4.PAS User of above units. 13-5 Chapter 14 - Complete example programs. Page 14-1 AMORT1.PAS Start of amortization program. 14-1 AMORT2.PAS Better amortization program. 14-1 AMORT3.PAS Useable amortization program. 14-1 AMORT4.PAS Neat amortization program. 14-1 AMORT5.PAS Complete amortization program. 14-2 LIST3.PAS List Pascal programs (ver 3.0). 14-3 LIST4.PAS List Pascal programs (ver 4 & 5). 14-3 LIST.EXE Ready to use list program. 14-3 TIMEDATE.PAS Get time and date (ver 3.0). 14-4 TIMEDAT4.PAS Get time and date (ver 4 & 5). 14-4 SETTIME.PAS Set a file's time and date. 14-4 SHAPES3.PAS Calculate areas of shapes. 14-4 OT3.PAS Directory list (ver 3.0). 14-5 OT4.PAS Directory list (ver 4 & 5). 14-5 OT.DOC How to use OakTree. 14-5 Chapter 15 - Encapsulation and Inheritance Page 15-1 ENCAP1.PAS First Encapsulation. 15-1 ENCAP2.PAS More Encapsulation. 15-5 INHERIT1.PAS First Inheritance. 15-7 VEHICLES.PAS An Object in a Unit. 15-9 CARTRUCK.PAS Descendant Objects. 15-10 INHERIT2.PAS Inheritance in Use. 15-10 INHERIT3.PAS Pointers and Arrays. 15-10 Chapter 16 - Virtual Methods Page 16-1 VIRTUAL1.PAS No Virtual Yet. 16-1 VIRTUAL2.PAS Virtual Methods in Use. 16-2 VIRTUAL3.PAS Virtuals and Pointers. 16-4 PERSON.PAS An Ancestor Object. 16-4 SUPERVSR.PAS Descendant Objects. 16-5 EMPLOYEE.PAS Using Virtual Methods. 16-5 ABOUT THE AUTHOR ___________________________________________________________ The author of this tutorial began programming in 1961 using FORTRAN on an IBM 1620. Since then, most of his career has been involved with designing digital logic for satellite application. In 1983, being somewhat burned out with logic design, he began a study of some of the more modern programming languages and has since made a complete career shift to software development. After learning Pascal, C was studied, followed by Modula-2 and Ada, and more recently C++. Rather than simply learning the syntax of each new language, modern methods of software engineering were studied and applied to effectively utilize the languages. He is current- ly employed by a large research and development laboratory where he continues to study, teach, and apply the newer programming languages.