Home page of Holt Software Associates  | Home page of the Turing Programming Language, the fastest way to teach programming concepts  | Home page of Holt Software's Java products  | Home page of Ready to Program with Java(tm) Technology, a Java development environment designed for education  | Information about Holt Software's courses for teachers  | Information about how to contact Holt Software  | Information about how students can purchase Holt Software's books and software  | Information about how schools and bookstores can purchase Holt Software's books and software

Holt Software Books    [Graphical Version]  |  [Printer Friendly Version]

[Cover of Book]

Problem Solving and Programming in Turbo Pascal


Book Information

Title: Problem Solving and Programming in Turbo Pascal
Author: J.N.P. Hume
ISBN: 0-921598-19-X
Publisher: Holt Software Associates Inc.
Binding: Hardcover
Pages: 326 pgs
Price: Bookstores & Schools: $29.50    Retail: $36.88
Ordering Information: For bookstores and schools, click here for ordering information.
For individuals click here for ordering information.
Program Examples: Not Available
Solutions Manual: Not Available

Book Description

This text is an important resource for teachers and students interested in computing. It meets the demand for a true ploblem solving textbook written especially for high schools. Well known author J.N.P. Hume demonstrates the essential link between programming and problem solving. He explores the various known methodologies and provides the fundamentals of computer programming for exploring the kinds of problems that can be examined by these methods.

Preface to Problem Solving and Programming in Turbo Pascal

Computer Programming is approximately forty years old and problem solving (both as concept and goal) has been with us since the beginning.

In the past, one of the common difficulties with problem solving-based computer science textbooks was that problem solving was often very much subjugated to programming language issues. Other textbooks tended to select a single systematic way of creating a computer program, usually by the step-by-step refinement technique, and apply it throughout the book to all programs.

In Problem Solving and Programming in Turbo Pascal, I have tried to create a text in which problem solving is much more than a servant of computer programming. Rather, I have tried to use computer programming as a means of illustrating various problem solving techniques. (This means that chapter headings that are a normal part of a book dedicated to computer programming do not appear. For example, searching and sorting is spread over several chapters that have titles concerning problem solving methods.)

I have tried to organize the sections in a useful and intuitive manner. In each chapter I have attempted to build successively on the concepts learned from previous chapters. It is important to note however, that individual teachers may have other preferences and so may wish to deal with the chapters in a different order.

I have also attempted to pose problems that all students can relate to. I have begun the book with arithmetic problems because here the idea of abstraction appears most naturally, for example, that 2 + 2 = 4. It is not my intention though, to push the solution of mathematical problems as the only way to approach the subject. Graphics-based problems are just as demanding and intriguing. Programs that produce graphical output also have a great appeal for students and provide a natural way of involving them and encouraging then to learn new skills in their search for the most dynamic graphic.

In Problem Solving and Programming in Turbo Pascal, graphics, in the form of character graphics, are used as soon as the notion of repetition is introduced. Pixel graphics comes a little later.

For each chapter I have included an Errors You Might Make section, in hope of assisting students to identify possible areas of difficulty, and thus saving them from frustration. Students should be encouraged to read these carefully to ensure that they recognize that these list mistakes to be avoided.

Every effort has been made to provide information for students in a readable, straightforward, and friendly manner. The sections have been laid out with easy-to-find subject headings. The Table of Contents and the Index will help all readers find specific information. A Glossary of Technical Terms has been provided to help students with the subject vocabulary. The language of the text is directed at the average high school student. My goal here was to make it as clear and readable as possible without over simplifying the material. It should be noted, however, that students with language difficulties may require additional assistance.

The name Turbo Pascal is a registered trademark of Borland International, Inc. The language contains extensions to the language designed by Niklaus Wirth in 1971, known now as Standard Pascal. Standard Pascal contains control constructs that permit structured programming and was intended to be a language with a small number of basic syntactic elements. Since its introduction, a number of different sets of extensions to the language have been introduced. The various extended Pascal languages are not compatible with each other. The set of extensions introduced in Turbo Pascal have become, in a sense, standard in that there are many users of this particular dialect of Pascal.

In this book I have used many of the extensions of Turbo Pascal without worrying that the resulting programs will not run under a Standard Pascal system. I have not mentioned a number of the parts of Standard Pascal that are associated with more advanced programming concepts such as sets, enumerated and subrange types, variant records, and packed arrays. As well, there are many subprograms of the Turbo Pascal run-time library that I have omitted. The version of Turbo Pascal used is 7.0. Some of its features may not be available if you are using earlier versions. The graphics programs have been tested on VGA graphics and may not work, without modification, for CGA.

Computer science has undergone many changes in the last forty years, and of all subject areas that we teach, it is perhaps the most fluid and hence interesting. The development of good programming languages like Turbo Pascal has allowed us to progress from spaghetti programs that were unstructured, error prone, and unmanageable to structured programs with proper control constructs. With these improvements, programs are no longer labyrinths of control. As teachers, this means that we are now free to concentrate on the important ideas of computer science.

Now it is time to marry the power of the computer to the human activity of problem solving. And that is what I have tried to do in this book.

J.N. Patterson Hume
University of Toronto


Table of Contents of Problem Solving and Programming in Turbo Pascal

  • 1. PROBLEM SOLVING: A MAP OF THE TERRITORY 1
  • Questions and Answers about Problem Solving 2
  • Well-Posed Problems 3
  • Problems 4
  • Calculators and Computers 5
  • Problem Solving and Computer Programming 6
  • Computer Programming and Systematics 7
  • How to Begin 7
  • The Editor 8
  • Questions and Answers 8
  • Technical Terms 8
  • Problems and Questions for Discussion 9
  • Questions for Discussion 9
  • Technical Terms you should now know 10
  • 2. THE TURBO PASCAL EDITOR 11
  • The Integrated Development Environment 12
  • Typing in the Edit Window 13
  • Editing What You Have Typed 13
  • Selecting a Menu Command 14
  • Dialog Boxes 15
  • Saving What You Have Typed on the Disk 16
  • Your Computer Disk 16
  • Running a Turbo Pascal Program 17
  • Starting a New Program 19
  • An Example Turbo Pascal Program 20
  • Menus of Commands 23
  • Printing a Program or its Output 23
  • Problems 23
  • Selecting Text in the Program Window 24
  • Editing the Program using Menu Commands 25
  • Searching for and Replacing Text 26
  • Technical Terms you should now know 26
  • 3. PROBLEMS THAT YOU KNOW HOW TO SOLVE 29
  • Questions and Answers about Arithmetic Problems 30
  • Basic Facts about Computer Programming 32
  • A Simple Program 33
  • Problems 35
  • Labelling Your Computer Results 35
  • Errors that you might make 36
  • Problems 37
  • Questions for Discussion 37
  • Technical Terms you should now know 38
  • 4. GENERALIZATION 39
  • Questions and Answers about General Programs 40
  • Storing Values in the Computer's Memory 41
  • Labelling Input and Output 44
  • Problems 45
  • Real Numbers 46
  • Formatting Output 48
  • Assignment Statements and Constants 49
  • Division of Integers 51
  • Understandable Programs and Comments 52
  • Errors that you might make 53
  • Problems 54
  • Questions for Discussion 55
  • Technical Terms you should now know 56
  • 5. BASIC DATA TYPES: INTEGER, REAL, AND STRING 57
  • Questions and Answers about Data Types 58
  • Representation of Data Types 59
  • Strings of Characters 60
  • Strings Can Be Joined 62
  • Selecting Part of a String 63
  • Strings of Single Characters 64
  • Codes for Characters 65
  • Errors that you might make 66
  • Problems 67
  • Questions for Discussion 67
  • Technical Terms you should now know 68
  • 6. THE ELEMENTS OF PROGRAMMING: REPETITION 69
  • Questions and Answers about Repetition 70
  • Looping 71
  • Testing Programs 74
  • Labelling of Tables 74
  • Stopping a Loop 77
  • Conditions 80
  • Errors that you might make 81
  • Questions for Discussion 82
  • Problems 83
  • Technical Terms you should now know 84
  • 7. THE ELEMENTS OF PROGRAMMING: COUNTED REPETITION 85
  • Questions and Answers about Counted Repetition 86
  • Counted Repetition 87
  • Doing Without the Counted Loop 90
  • Problems 91
  • Graphical Examples of Counted Loops 91
  • Loops Nested inside Loops 93
  • Changing the Colors on the Screen 94
  • Problems 95
  • Errors that you might make 95
  • Problems 96
  • Questions for Discussion 97
  • Technical Terms you should now know 97
  • 8. A SYSTEMATIC METHOD FOR PROBLEM SOLVING 99
  • A Systematic Method 100
  • Example Problem to be Solved 101
  • Tracing the Execution of a Program 104
  • Satisfying the Problem Specification 107
  • Another Example of the Systematic Method 107
  • Problems 111
  • Questions for Discussion 112
  • Technical Terms you should now know 112
  • 9. THE ELEMENTS OF PROGRAMMING: SELECTION 113
  • Questions and Answers about Selection 114
  • An Example of the Selection Construct 115
  • Problems 118
  • Three-way Selection 119
  • Errors that you might make 121
  • Problems 123
  • Nested Selections 124
  • Another Method for Multi-way Selections 127
  • User-Friendly Programs 130
  • Errors that you might make 131
  • Problems 131
  • Questions for Discussion 132
  • Technical Terms you should now know 132
  • 10. DIVIDE AND CONQUER: SUBPROGRAMS 133
  • Questions and Answers about Subprograms 134
  • Types of Subprograms 135
  • Predefined Functions 136
  • Defining a Function 137
  • Errors that you might make 140
  • Problems 140
  • Predefined Procedures 141
  • Defining a Procedure 142
  • Variable Parameters in Procedures 143
  • Global Variables 145
  • Versatility and Independence of Subprograms 149
  • Errors that you might make 149
  • Problems 150
  • Questions for Discussion 150
  • Technical Terms you should now know 151
  • 11. PIXEL GRAPHICS 153
  • Questions and Answers about Graphics Subprograms 154
  • Drawing Lines 156
  • Preparing to use the Graphics Mode 157
  • Drawing Boxes 157
  • Solving a Graphics Problem 160
  • Errors that you might make 164
  • Problems 164
  • Drawing Closed Curves 165
  • Random Positions 167
  • Errors that you might make 169
  • Problems 169
  • Animation 170
  • Changing Background Color 173
  • Errors that you might make 174
  • Problems 174
  • Questions for Discussion 175
  • Technical Terms you should now know 175
  • 12. STRUCTURED DATA TYPES: ARRAY, RECORD, AND FILE 177
  • Questions and Answers about Structured Data Types 178
  • Lists 179
  • Array-Type Constants 181
  • Sorting a List 181
  • Sorting by Selection 182
  • Input and Output with a Disk File 185
  • Related Lists 188
  • Frequency Distributions 191
  • Problems 193
  • Tables 194
  • Problems 195
  • Records 196
  • Errors that you might make 198
  • Problems 199
  • Questions for Discussion 200
  • Technical Terms you should now know 200
  • 13. SOLVE AN EASY PROBLEM FIRST 201
  • Questions and Answers about Simplification 202
  • An Example of Solving an Easy Problem First 203
  • Programming a Harder Part 205
  • Solving the Harder Problem 205
  • Another Example of Solving an Easy Problem First 208
  • Problems 212
  • Questions for Discussion 212
  • Technical Terms you should now know 213
  • 14. THE STEP-BY-STEP REFINEMENT METHOD OF PROBLEM SOLVING 215
  • Questions and Answers about Step-by-Step Refinement 216
  • The Step-by-Step Method 217
  • An Example of Step-by-Step Refinement 217
  • Procedures with Global Variables 221
  • Unfinished Procedures 223
  • Problems 223
  • Questions for Discussion 224
  • Technical Terms you should now know 225
  • 15. SEEKING BETTER SOLUTIONS 227
  • Questions and Answers on Program Efficiency 228
  • Solutions that are Very Much Better 229
  • Binary Search: A Better Solution 230
  • Better Solutions for Sorting 232
  • Problems 234
  • Questions for Discussion 235
  • Technical Terms you should now know 235
  • 16. PROBLEMS THAT COMPUTERS CAN NOT SOLVE 237
  • Questions and Answers about Insoluble Problems 238
  • Computational Complexity 238
  • Getting Approximate Solutions 239
  • Making Use of Problems that are Hard to Solve 240
  • Ethical Problems 240
  • Ethical Problems about Computers 241
  • Behaving Ethically about Computers 242
  • Artificial Intelligence 243
  • Questions for Discussion 244
  • Technical Terms you should now know 245
  • 17. PROBLEMS IN ORGANIZING DATA 247
  • Questions and Answers about Organizing Data 248
  • Ordered Lists 249
  • Array Implementation of an Ordered List 249
  • Linked List Implementation of an Ordered List 252
  • An Array Implementation of a Linked List 253
  • A Procedure for Inserting into a Linked List 255
  • Problems 258
  • Implementing a Linked List Using Pascal Pointers 258
  • Memory Management with Pointers 260
  • Problems 261
  • Binary Trees 262
  • Listing a Tree in Order 265
  • Growing a Tree 261
  • Problems 266
  • Stacks and Queues 266
  • Object-Oriented Programming 267
  • Classes and Inheritance 270
  • Representing Objects by Diagrams 272
  • Questions for Discussion 273
  • Technical Terms you should now know 273
  • APPENDICES
  • 1. Simplified Syntax of Turbo Pascal 275
  • 2. Predefined Subprograms 280
  • 3. Reserved Words in Turbo Pascal 287
  • 4. Predefined Constants 288
  • 5. IBM PC Keyboard Codes 290
  • 6. ASCII Character Set 292
  • 7. Glossary of Technical Terms 297
  • INDEX 313

  • [ Holt Software Home ] * [ Books (Graphical) ] * [ Books (Text) ] * [ Top of Page ] * [ Feedback ]