# Structured Programming Using Think Pascal On The Macintosh 1992 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-109f9db7fe4aaf9de87865fc88c2334c39adb91c0016ca4af044e5be89cdb3a9)

STRUCTURED PROGRAMMING USING THINK™ PASCAL ON THE MACINTOSH

Transcribed text:

STRUCTURED
PROGRAMMING
USING THINK™
PASCAL ON THE
MACINTOSH
J. Winston Crawley · William G. McArthur
Norman M. Jacobson

Image description: A book cover with a solid gray background, large white serif capital title text arranged in staggered lines, thin dark red rules and boxes framing parts of the title, and author names in white at the bottom.

Reading notes: Title lines are set in large display type with the first letters enlarged (S, P, T, P, M); the transcript follows reading order line by line. The trademark symbol TM after THINK is small and raised; rendered here as ™. The author line uses a middle dot separator between names as printed.

Languages: English

[Original Image 1](https://www.vintageapple.net/files/2f379f2e2d96e52a89ee88b57b18a051b184ef0e34d8a7a8df559cfb942a3511/cfe79ae75f03ea1dbf2d8763.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-c878e707e02a61c79c9de5212a5e4f38d89a37985f88b25c5c4d8724186f1964)

STRUCTURED PROGRAMMING USING THINK™ PASCAL ON THE MACINTOSH

Transcribed text:

STRUCTURED
PROGRAMMING
USING THINK™
PASCAL ON THE
MACINTOSH
J. Winston Crawley • William G. McArthur
Norman M. Jacobson

Image description: A gray book cover with large white serif capital title lettering, thin dark red rules and boxes framing the words USING and ON THE, and author names in white at the bottom.

Reading notes: Title is set in stacked display lettering; line breaks follow the visual layout, and the headline is given as a single line in the headline field. The trademark symbol after THINK is rendered as TM in the image and transcribed as ™.

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-1f02ffe104d94db50e8a1a1c56cc42a922f751e40c3008355480cd07aac958e0)

Transcribed text:

Structured Programming
Using   THINK™   Pascal on
tlie   Macintosh
J. Winston Crawley
Shippensburg University
William G. McArthur
Shippensburg University
Norman M. Jacobson
University of California, Irvine
PRENTICE HALL,   Englewood Cliffs, New Jersey 07632
-~.\

Reading notes: The copy reads 'tlie' in the subtitle, which is probably 'the' and may be an OCR artifact rather than printed text. A trailing fragment '-~.\' appears at the end and could be a graphic mark or OCR noise, so its meaning is uncertain. Reading order and exact layout of the title, subtitle, and author blocks cannot be confirmed without the image. The text was supplied locally rather than read from the image, so the transcript is left empty and the other fields rely only on that copy.

Printed product names: THINK™ Pascal · Macintosh

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-a9b6a8d585ea70e010fc71e37b67fc3774f05f0081c44b7fb7c32a36523e75f1)

Transcribed text:

Library   of Congress   Cataloglng~tn-Publlcatlon   Data
Crawley,   J.   Hinstan.
Structured   programming   using   Think   Pascal   an the Macintosh   I   J.
Hinstan   Crawley,   Hilliam   G.   McArthur,   Norman   M.   Jacobson.
p.   cm.
Includes   index.
ISBN   0-13-853037-8
1.   Macintosh   <Camputer>--Pragramming.   2.   THINK Pascal   <Computer
program   language>   3.   Structured programming.   I.   McArthur,   Hilllam
G.   II.   Jacobson,   Norman   M.   Ill.   Title.
QA76.8.M3C74   1992
005.265--dc20   91-19485
Acquisitions Editor/Editor-in-Chief: Marcia Horton
Production Editor: Bayani Mendoza de Leon
Cover Designer: Lundgren Graphics, Ltd.
Prepress Buyer: Linda Behrens
Manufacturing Buyer: Dave Dickey
Supplements Editor:   Alice   Dworkin
Copy Editor: Peter Zurita
Editorial Assistant: Diana Penha
CIP
The author and   publisher   of this book have used their best efforts in preparing
this book. These efforts include the development, research, and testing of the
theories and programs to determine their effectiveness. The author and   publisher
make no warranty of any kind, expressed or implied, with regard to these   pro-
grams or the documentation contained in this book. The author and   publisher
shall not be   liable   in any event for incidental or consequential damages in
connection with, or arising out of, the furnishing, performance, or use of these
programs.
© 1992 by Prentice-Hall, Inc.
A Simon   &   Schuster Company
Englewood   Cliffs,   New Jersey   07632
All rights reserved. No part of this book may be
reproduced, in any form or by any means,
without permission in writing from the   publisher.
Printed in the United States of America
10987654321
ISBN   0-13-853037-8
Prentice-Hall International (UK) Limited,   London
Prentice-Hall of   Australia   Pty. Limited,   Sydney
Prentice-Hall Canada Inc.,   Toronto
Prentice-Hall Hispanoamericana, S.A.,   Mexico
Prentice-Hall of India Private Limited,   New Delhi
Prentice-Hall of Japan, Inc.,   Tokyo
Simon   &   Schuster Asia Pte. Ltd.,   Singapore
Editora Prentice-Hall do   Brasil,   Ltda.,   Rio de Janeiro
TRADEMARK INFORMATION
Apple   is a registered trademark of   Apple
Computer Inc.
Apple-DOS   is a registered trademark of
Apple   Computer Inc.
dBase IV is a registered trademark of
Ashton-Tate.
IBM is a registered trademark of Interna-
tional Business Machines Corporation.
Laserwriter is a trademark of Hewlett-
Packard.
MS-DOS   is a trademark of Microsoft Cor-
poration.
MYS is a registered trademark of Interna-
tional Business Machines Corporation.
PC-DOS   is a trademark of International
Business Machines Corporation.
PostScript is a registered trademark of
Adobe Software.
THINK Pascal is a trademark of Borland
International Inc.
UCSD is a trademark of the Regents of the
University of   California.
Unix is a registered trademark of AT&T
Bell Laboratories.
VMS is a registered trademark of Digital
Equipment Corporation.

Reading notes: Possible OCR errors in the copyright and trademark text, e.g. 'MYS' and 'Cataloglng~tn-Publlcatlon' appear garbled. Reading order of the Library of Congress cataloging block and trademark list may be uncertain.

Printed product names: Macintosh · THINK Pascal · Apple-DOS · dBase IV · IBM · Laserwriter · MS-DOS · MYS · PC-DOS · PostScript · UCSD · Unix · VMS

Printed dates: 1992 · 91-19485

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-6f21f5f077befabcbf9646371fb941186d40ca16c7ca6d6d799b098b83636829)

Transcribed text:

Contents
PREFACE   TO   THE   INSTRUCTOR
PREFACE   TO   THE   STUDENT
1   GETTING STARTED
Objectives   1
Introduction   1
1-1   Computers and Programs   2
Computers, 2
Programs and Programming Languages, 2
The Programming Environment, 3
Pascal, 4
Writing and Running a THINK Pascal   Program.   5
Integrated Development Environments, 6
About this   Book.   6
Review,   7
Exercises,   7
1-2   Elements of the   Pascal   Language   8
Basic Elements, 8
Declarations, IO
Action   Statements,   12
Putting the Pieces Together, I   3
DPT (Defensive Programming Tips). I4
xv
xix
iii

Reading notes: Source text is a table of contents with page numbers; no product or price information is present.

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-16dffd340a7f6f23466b5d473dd1f4d93c8106e881c462f231c93f1790f116e3)

Transcribed text:

2
Review, 15
Exercises, 17
1-3   Planning   and Writing Looping Programs   (Part   1)   17
Algorithms, Data, and Refinement, 17
Planning the Looping Program, 19
Writing the Looping Program,   20
DPT, 23
Review, 24
Exercises, 25
1-4   Planning   and Writing Looping Programs   (Part   2)   25
Running the Program, 26
What   Can   Go Wrong, 27
Program Testing, 28
Case   Study   No. 1,   30
DPT, 33
Review, 35
Exercises, 36
FUNDAMENTALS   OF   PASCAL   PROGRAM   DESIGN
Objectives   37
2-1   The Assignment Statement   37
Numeric Assignment Statements, 38
DPT, 43
Character Assignment Statements, 45
String   Assignment Statements, 45
Examples, 47
Review, 47
Exercises, 51
2-2   Introduction to Procedures   54
An Example Procedure, 54
Some   Characteristics of Procedures, 55
Standard Procedures, 57
Some   Advantages of   Using   Procedures, 59
Some   Rewards of Focusing on a   Single   Task, 59
A Review of Program Design, 63
DPT, 64
Review, 65
Exercises, 66
2-3   Decision Structures   66
If-Then, 67
Conditions in Pascal, 69
iv
37
CONTENTS

Reading notes: Source appears to be a table of contents with page numbers; no advertised products or prices present.

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-9829f802cf8a6f19795b9db38b504ae0758c59e03b1961ef4afdfb01077db09f)

Transcribed text:

If-Then-Else,   70
DPT, 73
Adding to   Case   Study No. 1, 76
Testing,   77
Review,   80
Exercises,   80
2-4   Additional   Pascal   Topics   82
Formatting Output,   82
Output to   the   Printer,   86
Square Roots and Absolute   Value,   88
Functions,   90
Integer Operations: mod and div, 91
Introducing Predefined Identifiers: maxint, 92
Real-to-Integer Conversions, 93
Integer-to-Real Conversions, 95
Real-to-Real Conversions, 96
Other Standard Numeric Library Functions,   99
DPT,   100
Review,   JOI
Exercises,   102
2-5   More on Decision Structures   105
Boolean Expressions,   105
Multiple-Way Branches:   Genera~   108
The   Case   Structure,   112
Nested Decisions,   114
Testing,   117
DPT,   118
Review,   119
Exercises, 121
2-6   Yet More on Decision Structures   124
The   "Dangling   Else"   Pitfall, 124
Boolean Variables, 125
Enhancements of   the   Case   Statement, 127
Case   Study No. 2, 129
Review, 134
Exercises,   135
2-7   User-Defined Functions   139
An Example, 139
The Form of   a Pascal Function, 142
Parameters, 143
How to Write a Function,   144
DPT, 146
Review, 147
Exercises, 148
CONTENTS   v

Reading notes: Text appears to be a table of contents with OCR-like spacing; some characters such as 'JOI' and 'Genera~' may be misread.

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-d212b8c6762792e9de7d2aee417b02c42d3eea8ff8199656cac9ae70fcb042fa)

Transcribed text:

3
2-8   Modular Design and Testing   150
Testing,   150
Case Study No. 3, 151
Review, 161
Exercises, 161
USING   LOOPS
Objectives   163
3-1   Common Applications of Loops   163
Loop Planning, 163
Counting, 164
Accumulation, 167
Largest and Smallest, 171
Case Study No. 3 (Continued), 176
Testing, 178
DPT, 182
Review, 182
Exercises, 183
3-2   Pascal Looping Structures   185
Repeat-Until Loops, 185
While-Do Loops, 186
Repeat Versus While, 188
For-Do Loops, 188
Random Numbers,   190
More   Examples   Using   Loops, 191
DPT: Loops, 197
A First Look at A"ays,   200
DPT: A"ays,   206
Review,   207
Exercises,   209
3-3   Planning Loops   213
_   The Loop-Planning Process, 214
Loop Control: While-Do Versus Repeat-Until, 217
Examples,   220
DPT,   227
Review,   227
Exercises, 228
3-4   Nested Loops and Complex Loop Termination   234
Nested Loops, 234
vi
More Than   One   Termination Condition, 237
Use   of   Multiple-Termination Conditions: Searching, 244
Validating input, 244
DPT, 248
163
CONTENTS

Reading notes: Source appears to be a table of contents with page numbers; no headline or advertised products present. Some characters are damaged (e.g., 'A"ays' and 'A"ays' in place of 'Arrays'). Reading order of fragments is uncertain due to extraction from a multi-column contents page.

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-e1d21ca79ba2902dbcc38c42d7fa4d829592d3bcd999524a230aee382f82e46c)

Transcribed text:

Review, 250
Exercises, 251
3-5   Antibugging, Debugging, And Testing   258
Antibugging and Debugging, 258
Testing, 261
Summary, 267
Review, 267
4   MORE   ON   SUBPROGRAMS   269
Objectives   269
4-1   Parameters and Variables   269
Review and Terminology, 269
Reasons for Subprograms, 270
Value   and   Var   Parameters, 271
Parameters: Type Matching, 273
Choosing Parameters, 276
Global and   Local   Variables; Scope,   277
DPT,   280
Review, 281
Exercises, 283
4-2   Procedures and Functions   287
Nested Subprogram Invocation, 287
Procedures   Versus   Functions, 289
Writing a Subprogram, 291
Examples, 292
Recursion, 302
DPT,   305
Review, 307
Exercises, 308
4-3   Case   Studies   313
Case   Study No. 4, 313
Case   Study No. 5, 324
Case   Study No. 6, 326
Exercises, 340
5   ELEMENTARY DATA   STRUCTURING   347
Objectives   347
5-1   Text Files   347
Basic Text-File Operations, 348
File-Processing Activities, 350
Displaying and   Printing   Text Files, 350
CONTENTS   vii

Reading notes: Page numbers in a table of contents are listed as printed dates; these are section page references rather than publication dates.

Printed dates: 250 · 251 · 258 · 261 · 267 · 269 · 270 · 271 · 273 · 276 · 277 · 280 · 281 · 283 · 287 · 289 · 291 · 292 · 302 · 305 · 307 · 308 · 313 · 324 · 326 · 340 · 347 · 348 · 350

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-b9353c7a69e3955db48d5347e21f6fcfc38e9d5ca96b38699391ba03ada7bff0)

Transcribed text:

6
Summary of File-Handling Syntax, 354
Adding Lines   to   a Text File, 354
Interactive File Processing, 356
Searching and Modifying Text Files, 358
Text Files as Standard   110,   363
DPT, 364
Testing, 365
Review, 366
Exercises, 368
5-2   Records and Sets   372
Records, 372
Operations with Records, 376
Sets, 379
Set Operations,   380
An Example, 383
DPT, 383
Review, 388
Exercises   391
5-3   User-Defined   Data Types   393
Scalar Types, 393
User-Defined   Ordinal   Types, 396
Subrange Types, 399
Type and Range Checking,   400
Error Trapping,   402
More on Records,   404
DPT,   410
Review,   410
Exercises, 411
5-4   Case Studies: Rational Arithmetic   413
Case   Study No.   7   (A Rational Number Package), 413
Case   Study No. 8 (An Application of   the Rational-Number Package), 419
Exercises, 428
ONE~DIMENSIONAL   ARRAYS
Objectives   432
6-1   Defining and   Using   Arrays   432
The Need for Arrays, 432
viii
Array Declaration, 434
Array Reference, 435
Array Algorithms: Count-Controlled, 436
Array Algorithms: Condition-Controlled, 441
Initialization, Copying, and Shifting, 443
Processing Single Elements, 445
432
CONTENTS

Reading notes: Source appears to be a table of contents with page numbers rather than advertising copy; no advertised products or prices are present.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-c0af9ec52f9817dc8021157afda0a06558f88a6648ab4b1c3ee4327cffecd222)

Transcribed text:

7
Testing, 447
DPT, 448
Review,   450
Exercises, 451
6-2   Arrays and Data Structures   456
Arrays in Pascal, 456
Data Structures, 457
Parallel Arrays and Arrays of   Records, 458
Records Containing Arrays, 462
Other Combinations, 463
Testing, 467
DPT, 471
Review, 471
Exercises, 472
6-3   Searching and   Sorting   478
Linear Search, 478
Binary Search, 481
Selection   Sort,   484
Quicksort, 487
Comparing Efficiency Ratings, 492
DPT and Testing, 493
Review, 494
Exercises, 496
6-4   Case   Studies   499
Case   Study   No. 9, 499
Case   Study   No.   10,   514
Exercises, 525
MORE   ON   ARRAYS
Objectives   531
7-1   More on Arrays   531
Arrays ofArrays, 531
Interactive Input and Output of Two-Dimensional Arrays, 534
Text File Input and Output of Two-Dimensional Arrays, 536
Processing Two-Dimensional Arrays, 537
Matrices, 538
Matrix Multiplication,   540
Matrix Utilities, 541
Using Part of   an Array, 541
More than Two Dimensions, 544
DPT, 544
Review, 546
Exercises, 547
CONTENTS
531
ix

Reading notes: Source is a table of contents fragment; no headline or advertised products present Page numbers listed are not dates and are not extracted as printed dates

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/1#scan-20c01d4b5a1464883a092d1e2e4d8a811c711627072a4081ba911d501316f63c)

STRING MANIPULATION

Transcribed text:

8
9
10
STRING   MANIPULATION
Objectives   551
8-1   String   Data and   Operations   551
String Data Types, 551
Basic String Operations, 552
Built-In String Functions, 553
Built-In String Procedures, 559
String-to-Numeric Conversions, 561
DPT,   566
Testing, 569
Review, 569
Exercises, 571
8-2   String   Processing   575
Some Additional String Tools, 575
Character-Conversion Techniques,   580
Longer-Length Strings, 583
Review, 588
Exercises, 588
POINTERS
Objectives   594
9-1   Pointer   Variables   594
Pointers, 594
Declaring and Using Pointers, 595
Obtaining Data for   Pointer   Variables, 597
Managing Dynamic Memory Resources, 599
Advantages of Pointers,   605
Disadvantages of Pointers,   606
Using Pointers to Advantage,   606
DPT,   607
Review,   608
Exercises,   609
9-2   Using   Pointer   Variables   612
Linked Lists, 612
Saving Both Space and Time with Pointers, 616
Exercises, 625
RECURSION
Objectives   628
10-1   Thinking Recursively   628
Problem-Solving Tools, 628
x
551
594
628
CONTENTS

Reading notes: Source appears to be a table of contents rather than advertising copy; no products or prices present.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/02edb214f3f44467a766d14e061b2d77604c51b422f82b871a7067c40a8d1a71/Structured_Programming_Using_Think_Pascal_On_The_Macintosh_1992.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-structured-programming-using-think-pascal-on-the-macintosh-1992-c0d611/2.md)
