Preface |
|
v | |
Acknowledgments |
|
vi | |
About the Author |
|
vii | |
|
|
1 | (18) |
|
Your First Pascal Program |
|
|
1 | (1) |
|
|
1 | (1) |
|
|
2 | (1) |
|
|
2 | (1) |
|
Displaying Text: WRITELN, WRITE |
|
|
3 | (1) |
|
|
4 | (1) |
|
Integers and Real Numbers |
|
|
5 | (2) |
|
Evaluation of Arithmetic Expressions |
|
|
7 | (2) |
|
|
9 | (1) |
|
|
9 | (1) |
|
|
10 | (2) |
|
|
12 | (1) |
|
Type Conversion: ROUND, TRUNC |
|
|
13 | (1) |
|
Reading from the Keyboard: READLN, READ |
|
|
14 | (1) |
|
|
15 | (2) |
|
|
17 | (1) |
|
|
18 | (1) |
|
|
18 | (1) |
|
|
19 | (20) |
|
Standard Data Types and Functions |
|
|
19 | (1) |
|
|
19 | (1) |
|
Numeric Types in Turbo Pascal |
|
|
20 | (1) |
|
Standard Arithmetic Functions |
|
|
21 | (2) |
|
Example: The Power Function |
|
|
23 | (1) |
|
|
23 | (2) |
|
Turbo Pascal Additional Functions |
|
|
25 | (1) |
|
|
26 | (1) |
|
Standard Functions for Characters |
|
|
27 | (2) |
|
Strings in Standard Pascal |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
31 | (1) |
|
|
32 | (1) |
|
Simple Boolean Expressions |
|
|
32 | (2) |
|
Compound Boolean Expressions |
|
|
34 | (1) |
|
|
35 | (1) |
|
|
35 | (1) |
|
|
36 | (2) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
39 | (22) |
|
|
39 | (1) |
|
The Simple Decision: IF-THEN |
|
|
40 | (1) |
|
Example: Pascal Credit Card |
|
|
40 | (2) |
|
|
42 | (1) |
|
The IF-THEN-ELSE Construct |
|
|
43 | (2) |
|
|
45 | (1) |
|
Example: A Character Tester |
|
|
46 | (1) |
|
|
47 | (1) |
|
Example: Scores and Grades |
|
|
47 | (3) |
|
Tips on the IF-ELSE Puzzles |
|
|
50 | (1) |
|
The Multiple Choice: CASE |
|
|
51 | (1) |
|
Example: A Vending Machine |
|
|
51 | (1) |
|
Example: Number of Days in a Month |
|
|
52 | (2) |
|
Unconditional Branching: GOTO |
|
|
54 | (1) |
|
|
55 | (1) |
|
Turbo Pascal Features: EXIT, CASE-ELSE |
|
|
56 | (1) |
|
|
57 | (2) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (16) |
|
|
61 | (1) |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
65 | (1) |
|
Stepping Up and Stepping Down |
|
|
66 | (1) |
|
|
67 | (1) |
|
|
68 | (1) |
|
|
69 | (3) |
|
|
72 | (2) |
|
|
74 | (1) |
|
|
75 | (1) |
|
|
76 | (1) |
|
|
77 | (24) |
|
|
77 | (1) |
|
|
77 | (2) |
|
|
79 | (2) |
|
|
81 | (1) |
|
|
81 | (1) |
|
Naming User-Defined Types |
|
|
82 | (1) |
|
Arrays as Data Structures |
|
|
83 | (2) |
|
|
85 | (1) |
|
Example: Scores of One Student |
|
|
85 | (2) |
|
Displaying Tabulated Results |
|
|
87 | (3) |
|
Declaration of Arrays in the TYPE Section |
|
|
90 | (1) |
|
Example: Sorting an Array |
|
|
90 | (3) |
|
|
93 | (1) |
|
Example: Scores of Students |
|
|
94 | (2) |
|
|
96 | (1) |
|
|
97 | (1) |
|
|
98 | (1) |
|
|
99 | (2) |
|
|
101 | (20) |
|
|
101 | (1) |
|
Tips on OUTPUT Statements |
|
|
101 | (1) |
|
|
102 | (1) |
|
Using READLN for Numeric Input |
|
|
102 | (2) |
|
Using READ for Numeric Input |
|
|
104 | (1) |
|
Using READ for Character Input |
|
|
105 | (2) |
|
Using READLN for Character Input |
|
|
107 | (1) |
|
|
108 | (1) |
|
Example: Scrambling Letters |
|
|
109 | (2) |
|
Reading a Line of Text: EOLN |
|
|
111 | (1) |
|
Example: Character Counter |
|
|
111 | (1) |
|
Reading a File of Text: EOF |
|
|
112 | (1) |
|
Example: Frequency Counter |
|
|
112 | (1) |
|
|
113 | (1) |
|
Tips on String Input/Output |
|
|
113 | (1) |
|
|
114 | (2) |
|
String Functions and Procedures |
|
|
116 | (1) |
|
|
116 | (1) |
|
|
117 | (1) |
|
|
117 | (1) |
|
|
117 | (1) |
|
|
117 | (1) |
|
|
118 | (1) |
|
|
119 | (1) |
|
|
119 | (1) |
|
|
120 | (1) |
|
|
121 | (16) |
|
|
121 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
Passing Values to Procedures |
|
|
123 | (3) |
|
Passing Back Values from Procedures |
|
|
126 | (1) |
|
Global and Local Variables |
|
|
127 | (1) |
|
Example: Sorting Procedure |
|
|
127 | (3) |
|
|
130 | (1) |
|
Tips on the Scope of Variables |
|
|
131 | (2) |
|
|
133 | (1) |
|
|
134 | (1) |
|
|
134 | (1) |
|
|
135 | (2) |
|
|
137 | (18) |
|
|
137 | (1) |
|
Set Declaration and Assignment |
|
|
138 | (1) |
|
|
139 | (1) |
|
Set Operators and Operations |
|
|
140 | (1) |
|
|
140 | (1) |
|
|
140 | (1) |
|
|
140 | (1) |
|
Tips on Using Set Operators |
|
|
140 | (1) |
|
|
141 | (1) |
|
|
142 | (2) |
|
|
144 | (1) |
|
|
144 | (1) |
|
|
145 | (1) |
|
|
146 | (3) |
|
|
149 | (2) |
|
|
151 | (1) |
|
|
152 | (1) |
|
|
153 | (2) |
|
|
155 | (28) |
|
|
155 | (1) |
|
|
156 | (1) |
|
|
156 | (1) |
|
|
156 | (1) |
|
|
157 | (1) |
|
Opening a File for Input: RESET |
|
|
157 | (1) |
|
|
158 | (1) |
|
File Input Procedures: READ, READLN |
|
|
158 | (1) |
|
The EOF and EOLN Functions |
|
|
159 | (1) |
|
Example: Disk-File Text Analyzer |
|
|
159 | (3) |
|
|
162 | (1) |
|
Reading a TEXT File as a Set of Strings |
|
|
163 | (1) |
|
|
164 | (1) |
|
Creating a TEXT File: REWRITE |
|
|
165 | (1) |
|
File Output Procedures: WRITE, WRITELN |
|
|
165 | (1) |
|
|
166 | (2) |
|
|
168 | (4) |
|
|
172 | (1) |
|
|
173 | (3) |
|
|
176 | (2) |
|
Using the File Buffer Variable |
|
|
178 | (1) |
|
|
179 | (1) |
|
|
180 | (1) |
|
|
181 | (2) |
|
|
183 | (34) |
|
|
183 | (2) |
|
Example: Enhanced Payroll System |
|
|
185 | (7) |
|
Deleting Records from the File |
|
|
192 | (9) |
|
|
201 | (3) |
|
Enhance the Program Modularity |
|
|
204 | (10) |
|
|
214 | (1) |
|
|
214 | (1) |
|
|
215 | (1) |
|
|
215 | (2) |
|
Pointers and Linked Lists |
|
|
217 | (40) |
|
Dynamic Memory Allocation |
|
|
217 | (1) |
|
|
217 | (3) |
|
|
220 | (2) |
|
|
222 | (2) |
|
Passing Pointers as Parameters |
|
|
224 | (1) |
|
|
225 | (1) |
|
|
225 | (1) |
|
|
225 | (2) |
|
|
227 | (2) |
|
Example: A Linked List Demo |
|
|
229 | (3) |
|
|
232 | (1) |
|
|
233 | (1) |
|
Example: A List of Records |
|
|
234 | (1) |
|
|
235 | (8) |
|
Deleting Nodes from Lists |
|
|
243 | (10) |
|
|
253 | (1) |
|
|
254 | (1) |
|
|
255 | (2) |
|
|
256 | (1) |
Appendix A: The ASCII Character Set |
|
257 | (4) |
Appendix B: Reserved Words and Standard Identifiers |
|
261 | (4) |
Appendix C: Answers to Drills |
|
265 | (52) |
Index |
|
317 | |