Chapter 1 An Overview
1.1 Preview.............................................................14
1.2 Introduction to Programming Practice: Pascal......15
A Global View.........................................................15
The Road Ahead.....................................................15
Signs Along the Road..............................................16
1.3 Hardware: Computers and Peripherals.................17
The CPU................................................................18
Other Components and Packaging............................19
1.4 The World of Programming..................................20
What is Programming?.............................................20
“Real world” and “Abstract World”..............................20
1.5 Pascal..............................................................21
An example Pascal program.....................................22
Running Programs: Compiling, Linking, Executing......23
1.6 Communicating to Computers.............................24
Typing....................................................................24
1.7 Chapter 1 Review...............................................27
Chapter 2 Computing: A Short Survey of Some
Applications
2.1 Preview.............................................................30
2.2 Software and Applications...................................30
2.3 Application Software...........................................33
Editor Application.....................................................34
Typing Applications..................................................35
Calculator Applications.............................................36
Retrieve Application: A Tiny Database........................38
Planner-Calendar Application.....................................39
Bar Plot Application..................................................41
Drill Application........................................................42
SSS: Small and Simple Spreadsheet.........................43
2.4 Chapter 2 Review................................................47
Chapter 3 Programming Language: Pascal
3.1 Preview...............................................................50
iv Table of Contents
3.2 Languages..........................................................50
Syntax and Semantics..............................................50
Syntax Diagrams......................................................53
3.3 Pascal Programs.................................................56
Program Format........................................................56
Program Presentation................................................59
More Pascal Programming: Data and Actions..............60
Data Items................................................................61
Actions: Arithmetic Operations...................................63
3.4 More Example Programs......................................66
3.5 Chapter 3 Review.................................................69
3.6 Chapter 3 Problems.............................................70
3.7 Chapter 3 Programming Project............................74
Getting Acquainted...................................................74
Chapter 4 Data and Actions
4.1 Preview....................................................................76
4.2 Programming: Data and Actions...............................76
Declarations: Syntax Diagrams from the Bottom........76
Simple Input and Output in Pascal............................80
4.3 More Programs: A Top View of Pascal....................83
4.4 Programming Style...................................................85
4.5 Layout of Programs..................................................86
4.6 More Programs: Continued.......................................89
Actions: Pre-Defined Standard Functions in Pascal....89
Libraries: Using Units in Pascal.................................92
4.7 A Foretaste of Procedures.........................................94
4.8 Chapter 4 Review.....................................................96
4.9 Chapter 4 Problems...................................................96
4.10 Chapter 4 Programming Projects...............................97
Generate Conversion Tables......................................97
Observing Errors......................................................97
Demilitarize Time.....................................................98
TipTable...................................................................99
STT: Sales Tax Table..................................................100
SSP: Simple Side Plot................................................101
Chapter 5 The Four Fundamental Forms
in Pascal
5.1 Preview....................................................................105
Table of Contents v
5.2 The Sequence Form in Pascal....................................105
5.3 Conditions in Pascal..................................................107
5.4 Repetition Form: The WHILE statement....................108
Tracing Loops...........................................................110
5.5 WHILES, REALS, and Errors.....................................114
5.6 Selection Forms in Pascal..........................................117
5.7 More Selections: Combinations of Selection Forms....119
Confusion in Choices................................................120
More Nesting of Choices..........................................120
Alternative Ways to Code Selections.........................121
5.8 Select Form: Handling Many Branches....................124
5.9 Awkward Nests: General Nesting............................127
Mixed Nests: Repetition and Selections.....................128
5.10 Subprograms: Using Subprograms as Black Boxes....130
The ShortSort Library................................................134
Notation for Defined Procedures...............................137
Procedures vs. Functions..........................................140
5.11 Binary Logic Library: BitLib.....................................145
5.12 Chapter 5 Review.....................................................149
5.13 Chapter 5 Problems...................................................150
5.14 Chapter 5 Programming Problems............................152
Sequence Problems...................................................153
Selection Problems....................................................153
Loop Problems.........................................................153
Subprogram Problems..............................................153
Debugging Problems................................................154
Selection Programs...................................................156
Procedures and Repetitions.......................................157
Josephus’ Problem....................................................158
5.15 Chapter 5 Programming Projects...............................159
Project A: Change Change.......................................159
Project B: Payroll.....................................................160
Project C: Quadratic Roots.......................................160
Project D: Digital Circuits.........................................160
Project E: Roll Your Own.........................................161
CRN: Convert Roman Numbers..............................161
GPR: Growing Pay Roll...........................................161
MWM: Many Ways to Mid......................................162
DFP: Data Flow Programming.................................163
Chapter 6 Pascal with Bigger Blocks
6.1 Preview....................................................................169
vi Table of Contents
6.2 Conglomerations......................................................169
Mixed and Nested Forms..........................................169
6.3 More Data................................................................171
External....................................................................171
CASE Form...............................................................173
6.4 More Repetition Forms.............................................175
6.5 The For Loop............................................................177
6.6 Character Type.........................................................182
in Pascal...................................................................182
Representation of Characters.....................................185
6.7 Boolean Type in Pascal.............................................190
6.8 More Types..............................................................193
Big Types in Pascal...................................................193
Even Bigger Types....................................................193
Smaller Types...........................................................194
6.9 Programmer Defined Types......................................195
Enumerated Types....................................................195
Subrange Types In Pascal..........................................198
6.10 Strings in Pascal........................................................198
6.11 Simple Files in Pascal................................................201
More Files: Input and Output....................................205
6.12 Modification of Programs.........................................207
6.13 Programming Style...................................................209
Documentation.........................................................209
Further Guidelines for Identifiers..............................212
A Bad Style Horror Story..........................................213
Criticism of the MeanMean Program.........................215
6.14 Errors in Programming.............................................216
Syntactic Errors.........................................................216
Execution Errors.......................................................217
Logical Errors...........................................................217
Other Errors..............................................................217
6.15 Debugging, Testing, Proving....................................217
6.16 Chapter 6 Review.....................................................219
6.17 Chapter 6 Problems...................................................219
6.18 Chapter 6 Programming Problems............................221
6.19 Chapter 6 Programming Projects...............................224
Plotting Programs.....................................................224
Modify Calculator.....................................................226
Statistics (Rainfall).....................................................227
Project Plotup...........................................................227
BSD: Big Statistics Data.............................................228
Table of Contents vii
BTD: Big Text Data...................................................229
SMC: Small Monthly Calendar.................................230
Chapter 7 Better Blocks: Procedures and
Libraries
7.1 Preview....................................................................233
7.2 Procedures in Pascal.................................................233
Use and Definition....................................................233
7.3 Syntax of Subprogram Forms....................................235
Procedures in Pascal.................................................235
More Examples of Pascal Procedures.........................239
Power Procedure......................................................242
7.4 Passing Parameters....................................................242
In, Out, In and Out, and Neither...............................242
BigChange................................................................242
BigPay......................................................................245
A Miscellany of procedures......................................248
A Second Miscellany of procedures..........................250
7.5 Procedures with Char, Boolean and Other Types.......252
Generalized Item Types............................................255
7.6 Procedures with User-Defined types..........................256
7.7 More on Passing Parameters.....................................259
7.8 Nested Procedures....................................................261
7.9 Functions in Pascal...................................................264
Many Functions........................................................266
7.10 SubPrograms: Variations on a theme.........................269
7.11 Recursion in Pascal...................................................272
7.12 Libraries in Pascal.....................................................275
Units.........................................................................275
UtilityLib: a custom-made utilities Library.................278
Other Libraries: DateLib, BitLib, CharLib..................281
The Interaction of Many Libraries.............................288
7.13 Function and Procedure Types..................................291
7.14 Top-Down Development..........................................296
Pay Again.................................................................296
7.15 Chapter 7 Review.....................................................299
7.16 Chapter 7 Problems...................................................300
7.17 Chapter 7 Programming Problems............................302
Random Projects.......................................................302
DateLib.....................................................................305
Create Libraries.........................................................306
viii Table of Contents
FinanceLib................................................................307
Change Again: Done Properly with Procedures.......308
MeanLib...................................................................308
7.18 Chapter 7 Programming Projects...............................310
DMT: DeMilitarizeTime Lab with Procedures..........310
SLL: Small Library Project........................................311
Chapter 8 Pascal Data Structures
8.1 Preview....................................................................314
8.2 Arrays in Pascal........................................................314
ChangeMaker and Variance......................................317
Parallel Arrays: Part Inventory.................................319
A Tiny Data Base: Retrieving Strings from Arrays....321
Arrays as Parameters.................................................323
IntArrayLib: Integer Array Library..........................325
8.3 Two Dimensional Arrays in Pascal............................328
Arrays of Arrays—Two Dimensional Arrays.............328
8.4 N-Dimensional Arrays..............................................331
More Dimensions.....................................................331
8.5 Records in Pascal......................................................333
ComplexLib: A Library for Complex Numbers.........337
Records of Records: Nested Records........................339
Arrays of Records in Pascal.......................................342
Records of Arrays.....................................................345
Matrix Library..........................................................347
8.6 Sets in Pascal.............................................................352
More Sets (Optional).................................................355
8.7 Dynamic Variables and Pointers in Pascal.................359
8.8 Chapter 8 Review.....................................................361
8.9 Chapter 8 Problems...................................................361
8.10 Chapter 8 Programming Projects...............................363
Gas Project................................................................363
Library Projects.........................................................364
BSL: Big Stat Lab......................................................364
Chapter 9 Algorithms to Run With
9.1 Preview....................................................................368
9.2 Sorting Algorithms...................................................369
A Context for Sorting................................................369
Count Sort................................................................373
Bubble Sort...............................................................375
Table of Contents ix
Select Sort.................................................................376
9.3 Improving sorts (Optional)........................................377
Recursive Sort: Merge Sort.......................................378
Another Merge Sort: the Von Neumann Sort...........380
9.4 Searching..................................................................387
Binary Search............................................................387
9.5 Implementing Stacks and Queues..............................391
StackLib: Stack as an Abstract Data Type..................391
Dynamic Stacks........................................................395
QueueLib..................................................................397
Big Cardinals............................................................400
SetLib: Stack of Strings.............................................404
9.6 Trees.........................................................................407
9.7 Chapter 9 Review.....................................................412
9.8 Chapter 9 Problems...................................................412
9.9 Chapter 9 Programming Projects...............................415
Queue Abstract Data Type........................................415
PES: Performance Evaluation of Sorts.......................416
VS: Visual Sorts.......................................................418
Chapter 10 The Seven Step Method
10.1 Method: Part II........................................................425
The Seven Step Method.............................................425
10.2 Design Stage: Acme Payroll System..........................426
1. Problem Definition...............................................426
Problem Definition Application.........................426
2. Solution Design....................................................427
Solution Design Application..............................427
3. Solution Refinement.............................................428
Solution Refinement Application.......................428
4. Testing Strategy Development..............................429
Testing Strategy Development Application........429
10.3 Implementation Stage: Acme Payroll System.............431
5. Program Coding and Testing................................431
Case Study: The Acme Payroll System..............432
6. Documentation Completion.................................444
Documentation Completion Application............444
7. Program Maintenance..........................................445
Program Maintenance Application....................445
10.4 An Advanced Case Study: Building a Text Index.......445
Design Stage.............................................................446
1. Problem Definition.......................................446
2. Solution Design............................................446
3. Solution Refinement......................................447
x Table of Contents
Binary Search Tree Unit.....................................449
Queues Unit......................................................451
Implementation Stage...............................................452
4. Testing Strategy Development.......................452
5. Program Coding and Testing........................453
6. Documentation.............................................463
7. Program Maintenance...................................463
10.5 Chapter 10 Review....................................................464
10.6 Chapter 10 Programming Problems...........................464
1. Editor Application................................................464
2. Typing.................................................................470
3. Calculator Applications........................................472
10.7 Chapter 10 Programming Projects.............................473
10.8 Level 1 — Getting Started..........................................473
1–1. General.............................................................474
A Guessing Game..............................................474
1–2. Business............................................................474
Computing a Customer's Change.......................474
1–3. Scientific...........................................................475
A Bouncing Ball................................................475
10.9 Level 2 — Getting Organized with Procedures..........477
2–1. General.............................................................477
Your Age in Days..............................................477
2–2 Business..............................................................477
What’s the Cost of My Mortgage?......................477
2–3 Scientific.............................................................478
Solving the Quadratic Equation.........................478
10.10 Level 3 — Getting Fancier with Parameters..............479
3–1. General.............................................................479
Count the Word Occurrences in a Text...............479
Processing Personnel Data.................................480
3–3. Scientific...........................................................481
Plotting a Function............................................481
10.11 Level 4 — Getting Your Wings with Units................483
4–1 General...............................................................483
The Kwic Index.................................................483
4–2 Business..............................................................484
Information Retrieval........................................484
4–3 Scientific.............................................................486
Complex Algebra..............................................486
İndir : Programming in Pascal 
Boyut: 0.7 mb, 2966 defa indirildi.

Boyut: 0.7 mb, 2966 defa indirildi.
Henüz yorum yapılmamış


