Start Programming Using Object Pascal by Motaz Abdel Azeem - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Chapter Tw

T o

Structured Programming

Introduction.............................................................................................................................................84

Procedures...............................................................................................................................................84

Parameters...............................................................................................................................................85

Restaurant program using procedures.....................................................................................................86

Functions..................................................................................................................................................87

Restaurant program using functions........................................................................................................88

Local Variables........................................................................................................................................89

News database application......................................................................................................................90

Functions as input parameters.................................................................................................................93

Procedure and function output parameters.............................................................................................94

Calling by reference.................................................................................................................................95

Units.........................................................................................................................................................97

Units in Lazarus and Free Pascal............................................................................................................99

Units written by the programmer.............................................................................................................99

Hejri Calendar.......................................................................................................................................100

Procedure and function Overloading.....................................................................................................103

Default value parameters.......................................................................................................................104

Sorting....................................................................................................................................................105

Bubble sort algorithm............................................................................................................................105

Sorting students' marks..........................................................................................................................107

Selection Sort algorithm........................................................................................................................109

Shell sort algorithm................................................................................................................................110

String sorting..........................................................................................................................................112

Sorting students name program..............................................................................................................112

Sort algorithms comparison...................................................................................................................113