Preface |
|
xxx | |
|
Introduction to Computers, the Internet and the World Wide Web |
|
|
1 | (25) |
|
|
2 | (2) |
|
|
4 | (1) |
|
|
4 | (1) |
|
Evolution of Operating Systems |
|
|
5 | (1) |
|
Personal Computing, Distributed Computing and Client/Server Computing |
|
|
6 | (1) |
|
Machine Languages, Assembly Languages and High-level Languages |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
9 | (1) |
|
The Key Software Trend: Object Technology |
|
|
10 | (1) |
|
C++ and C++ How to Program |
|
|
11 | (1) |
|
Java and Java How to Program |
|
|
12 | (1) |
|
Other High-level Languages |
|
|
13 | (1) |
|
|
13 | (1) |
|
The Basics of a typical C Program Development Environment |
|
|
14 | (2) |
|
|
16 | (1) |
|
|
17 | (1) |
|
History of the World Wide Web |
|
|
18 | (1) |
|
General Notes About C and this Book |
|
|
19 | (7) |
|
Introduction to C Programming |
|
|
26 | (30) |
|
|
27 | (1) |
|
A Simple C Program: Printing a Line of Text |
|
|
27 | (4) |
|
Another Simple C Program: Adding Two Integers |
|
|
31 | (4) |
|
|
35 | (2) |
|
|
37 | (3) |
|
Decision Making: Equality and Relational Operators |
|
|
40 | (16) |
|
Structured Program Development in C |
|
|
56 | (44) |
|
|
57 | (1) |
|
|
57 | (1) |
|
|
58 | (1) |
|
|
58 | (2) |
|
The if Selection Structure |
|
|
60 | (2) |
|
The if/else Selection Structure |
|
|
62 | (4) |
|
The while Repetition Structure |
|
|
66 | (1) |
|
Formulating Algorithms: Case Study 1 (Counter-Controlled Repetition) |
|
|
67 | (2) |
|
Formulating Algorithms with Top-down, Stepwise Refinement: Case Study 2 (Sentinel-Controlled Repetition) |
|
|
69 | (6) |
|
Formulating Algorithms with Top-down, Stepwise Refinement: Case Study 3 (Nested Control Structures) |
|
|
75 | (2) |
|
|
77 | (3) |
|
Increment and Decrement Operators |
|
|
80 | (20) |
|
|
100 | (42) |
|
|
101 | (1) |
|
The Essentials of Repetition |
|
|
101 | (1) |
|
Counter-Controlled Repetition |
|
|
102 | (2) |
|
The for Repetition Structure |
|
|
104 | (2) |
|
The for Structure: Notes and Observations |
|
|
106 | (1) |
|
Examples Using the for Structure |
|
|
107 | (4) |
|
The switch Multiple-Selection Structure |
|
|
111 | (5) |
|
The do/while Repetition Structure |
|
|
116 | (2) |
|
The break and continue Statements |
|
|
118 | (2) |
|
|
120 | (2) |
|
Confusing Equality (==) and Assignment (=) Operators |
|
|
122 | (2) |
|
Structured Programming Summary |
|
|
124 | (18) |
|
|
142 | (54) |
|
|
143 | (1) |
|
|
143 | (2) |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
147 | (4) |
|
|
151 | (2) |
|
|
153 | (1) |
|
Calling Functions: Call by Value and Call by Reference |
|
|
154 | (1) |
|
|
155 | (4) |
|
Example: A Game of Chance |
|
|
159 | (3) |
|
|
162 | (2) |
|
|
164 | (3) |
|
|
167 | (3) |
|
Example Using Recursion: The Fibonacci Series |
|
|
170 | (4) |
|
|
174 | (22) |
|
|
196 | (53) |
|
|
197 | (1) |
|
|
197 | (2) |
|
|
199 | (1) |
|
|
199 | (12) |
|
Passing Arrays to Functions |
|
|
211 | (5) |
|
|
216 | (2) |
|
Case Study: Computing Mean, Median and Mode Using Arrays |
|
|
218 | (3) |
|
|
221 | (5) |
|
Multiple-Subscripted Arrays |
|
|
226 | (23) |
|
|
249 | (57) |
|
|
250 | (1) |
|
Pointer Variable Declarations and Initialization |
|
|
250 | (1) |
|
|
251 | (3) |
|
Calling Functions by Reference |
|
|
254 | (4) |
|
Using the const Qualifier with Pointers |
|
|
258 | (6) |
|
Bubble Sort Using Call by Reference |
|
|
264 | (5) |
|
Pointer Expressions and Pointer Arithmetic |
|
|
269 | (3) |
|
The Relationship between Pointers and Arrays |
|
|
272 | (4) |
|
|
276 | (1) |
|
Case Study: A Card Shuffling and Dealing Simulation |
|
|
277 | (4) |
|
|
281 | (25) |
|
|
306 | (46) |
|
|
307 | (1) |
|
Fundamentals of Strings and Characters |
|
|
307 | (2) |
|
Character Handling Library |
|
|
309 | (5) |
|
String Conversion Functions |
|
|
314 | (5) |
|
Standard Input/Output Library Functions |
|
|
319 | (4) |
|
String Manipulation Functions of the String Handling Library |
|
|
323 | (2) |
|
Comparison Functions of the String Handling Library |
|
|
325 | (3) |
|
Search Functions of the String Handling Library |
|
|
328 | (5) |
|
Memory Functions of the String Handling Library |
|
|
333 | (4) |
|
Other Functions of the String Handling Library |
|
|
337 | (15) |
|
|
352 | (28) |
|
|
353 | (1) |
|
|
353 | (1) |
|
Formatting Output with printf |
|
|
354 | (1) |
|
|
354 | (2) |
|
Printing Floating-Point Numbers |
|
|
356 | (1) |
|
Printing Strings and Characters |
|
|
357 | (1) |
|
Other Conversion Specifiers |
|
|
358 | (2) |
|
Printing with Field Widths and Precisions |
|
|
360 | (2) |
|
Using Flags in the printf Format-Control String |
|
|
362 | (3) |
|
Printing Literals and Escape Sequences |
|
|
365 | (1) |
|
Formatting Input with scanf |
|
|
366 | (14) |
|
C Structures, Unions, Bit Manipulations and Enumerations |
|
|
380 | (35) |
|
|
381 | (1) |
|
|
381 | (3) |
|
|
384 | (1) |
|
Accessing Members of Structures |
|
|
384 | (2) |
|
Using Structures with Functions |
|
|
386 | (1) |
|
|
386 | (1) |
|
Example: High-Performance Card Shuffling and Dealing Simulation |
|
|
387 | (2) |
|
|
389 | (3) |
|
|
392 | (8) |
|
|
400 | (3) |
|
|
403 | (12) |
|
|
415 | (35) |
|
|
416 | (1) |
|
|
416 | (2) |
|
|
418 | (1) |
|
Creating a Sequential-Access File |
|
|
419 | (5) |
|
Reading Data from a Sequential-Access File |
|
|
424 | (5) |
|
|
429 | (1) |
|
Creating a Randomly Accessed File |
|
|
429 | (2) |
|
Writing Data Randomly to a Randomly Accessed File |
|
|
431 | (2) |
|
Reading Data Randomly from a Randomly Accessed File |
|
|
433 | (2) |
|
Case Study: A Transaction-Processing Program |
|
|
435 | (15) |
|
|
450 | (52) |
|
|
451 | (1) |
|
Self-Referential Structures |
|
|
452 | (1) |
|
Dynamic Memory Allocation |
|
|
452 | (2) |
|
|
454 | (7) |
|
|
461 | (6) |
|
|
467 | (6) |
|
|
473 | (29) |
|
|
502 | (12) |
|
|
503 | (1) |
|
The #include Preprocessor Directive |
|
|
503 | (1) |
|
The #define Preprocessor Directive: Symbolic Constants |
|
|
504 | (1) |
|
The #define Preprocessor Directive: Macros |
|
|
504 | (2) |
|
|
506 | (1) |
|
The #error and #pragma Preprocessor Directives |
|
|
507 | (1) |
|
The # and ## Operators |
|
|
507 | (1) |
|
|
508 | (1) |
|
Predefined Symbolic Constants |
|
|
508 | (1) |
|
|
509 | (5) |
|
|
514 | (22) |
|
|
515 | (1) |
|
Redirecting Input/Output on UNIX and DOS Systems |
|
|
515 | (1) |
|
Variable-Length Argument Lists |
|
|
516 | (2) |
|
Using Command-Line Arguments |
|
|
518 | (2) |
|
Notes on Compiling Multiple-Source-File Programs |
|
|
520 | (1) |
|
Program Termination with exit and atexit |
|
|
521 | (2) |
|
The volatile Type Qualifier |
|
|
523 | (1) |
|
Suffixes for Integer and Floating-Point Constants |
|
|
523 | (1) |
|
|
523 | (3) |
|
|
526 | (2) |
|
Dynamic Memory Allocation: Functions calloc and realloc |
|
|
528 | (1) |
|
The Unconditional Branch: goto |
|
|
529 | (7) |
|
|
536 | (27) |
|
|
537 | (1) |
|
|
537 | (1) |
|
A Simple Program: Adding Two Integers |
|
|
538 | (2) |
|
|
540 | (1) |
|
|
541 | (2) |
|
|
543 | (2) |
|
References and Reference Parameters |
|
|
545 | (4) |
|
Default Arguments and Empty Parameter Lists |
|
|
549 | (2) |
|
Unary Scope Resolution Operator |
|
|
551 | (3) |
|
|
554 | (1) |
|
|
555 | (8) |
|
C++ Classes and Data Abstraction |
|
|
563 | (47) |
|
|
564 | (1) |
|
Implementing a Time Abstract Data Type with a Class |
|
|
565 | (7) |
|
Class Scope and Accessing Class Members |
|
|
572 | (1) |
|
Separating Interface from Implementation |
|
|
573 | (4) |
|
Controlling Access to Members |
|
|
577 | (3) |
|
Access Functions and Utility Functions |
|
|
580 | (3) |
|
Initializing Class Objects: Constructors |
|
|
583 | (1) |
|
Using Default Arguments with Constructors |
|
|
584 | (4) |
|
|
588 | (1) |
|
When Constructors and Destructors Are Called |
|
|
588 | (3) |
|
Using Data Members and Member Functions |
|
|
591 | (5) |
|
A Subtle Trap: Returning a Reference to a private Data Member |
|
|
596 | (2) |
|
Assignment by Default Memberwise Copy |
|
|
598 | (2) |
|
|
600 | (10) |
|
|
610 | (40) |
|
|
611 | (1) |
|
const (Constant) Objects and const Member Functions |
|
|
611 | (9) |
|
Composition: Objects as Members of Classes |
|
|
620 | (5) |
|
friend Functions and friend Classes |
|
|
625 | (3) |
|
|
628 | (5) |
|
Dynamic Memory Allocation with Operators new and delete |
|
|
633 | (2) |
|
|
635 | (5) |
|
Data Abstraction and Information Hiding |
|
|
640 | (3) |
|
Example: Array Abstract Data Type |
|
|
641 | (1) |
|
Example: String Abstract Data Type |
|
|
642 | (1) |
|
Example: Queue Abstract Data Type |
|
|
642 | (1) |
|
Container Classes and Iterators |
|
|
643 | (7) |
|
|
650 | (32) |
|
|
651 | (1) |
|
Fundamentals of Operator Overloading |
|
|
652 | (1) |
|
Restrictions on Operator Overloading |
|
|
653 | (2) |
|
Operator Functions as Class Members vs. as friend Functions |
|
|
655 | (1) |
|
Overloading Stream-Insertion and Stream-Extraction Operators |
|
|
656 | (3) |
|
Overloading Unary Operators |
|
|
659 | (1) |
|
Overloading Binary Operators |
|
|
659 | (1) |
|
Case Study: An Array Class |
|
|
660 | (12) |
|
|
672 | (1) |
|
|
673 | (9) |
|
|
682 | (38) |
|
|
683 | (2) |
|
Inheritance: Base Classes and Derived Classes |
|
|
685 | (2) |
|
|
687 | (1) |
|
Casting Base-Class Pointers to Derived-Class Pointers |
|
|
687 | (6) |
|
|
693 | (1) |
|
Overriding Base-Class Members in a Derived Class |
|
|
693 | (5) |
|
Public, Protected and Private Inheritance |
|
|
698 | (1) |
|
Direct Base Classes and Indirect Base Classes |
|
|
699 | (1) |
|
Using Constructors and Destructors in Derived Classes |
|
|
699 | (4) |
|
Implicit Derived-Class Object to Base-Class Object Conversion |
|
|
703 | (1) |
|
Software Engineering with Inheritance |
|
|
704 | (1) |
|
Composition vs. Inheritance |
|
|
705 | (1) |
|
``Uses A'' and ``Knows A'' Relationships |
|
|
706 | (1) |
|
Case Study: Point, Circle, Cylinder |
|
|
706 | (14) |
|
C++ Virtual Functions and Polymorphism |
|
|
720 | (23) |
|
|
721 | (1) |
|
Type Fields and switch Statements |
|
|
721 | (1) |
|
|
722 | (1) |
|
Abstract Base Classes and Concrete Classes |
|
|
723 | (1) |
|
|
723 | (2) |
|
New Classes and Dynamic Binding |
|
|
725 | (1) |
|
|
726 | (1) |
|
Case Study: Inheriting Interface and Implementation |
|
|
726 | (9) |
|
Polymorphism, virtual Functions and Dynamic Binding ``Under the Hood'' |
|
|
735 | (8) |
|
|
743 | (45) |
|
|
745 | (1) |
|
|
745 | (3) |
|
Iostream Library Header Files |
|
|
746 | (1) |
|
Stream Input/Output Classes and Objects |
|
|
746 | (2) |
|
|
748 | (4) |
|
Stream-Insertion Operator |
|
|
748 | (2) |
|
Cascading Stream-Insertion/Extraction Operators |
|
|
750 | (1) |
|
Output of char * Variables |
|
|
751 | (1) |
|
Character Output with Member Function put; Cascading puts |
|
|
752 | (1) |
|
|
752 | (6) |
|
Stream-Extraction Operator |
|
|
752 | (3) |
|
get and getline Member Functions |
|
|
755 | (3) |
|
istream Member Functions peek, putback and ignore |
|
|
758 | (1) |
|
|
758 | (1) |
|
Unformatted I/O with read, gcount and write |
|
|
758 | (1) |
|
|
759 | (5) |
|
Integral Stream Base: dec, oct, hex and setbase |
|
|
759 | (1) |
|
Floating-Point Precision (precision, setprecision) |
|
|
760 | (2) |
|
Field Width (setw, width) |
|
|
762 | (1) |
|
User-Defined Manipulators |
|
|
763 | (1) |
|
|
764 | (10) |
|
|
764 | (1) |
|
Trailing Zeros and Decimal Points (ios: : showpoint) |
|
|
765 | (1) |
|
Justification (ios::left, ios::right, ios::internal) |
|
|
766 | (2) |
|
|
768 | (2) |
|
Integral Stream Base (ios::dec, ios::oct, ios::hex, ios::showbase) |
|
|
770 | (1) |
|
Floating-Point Numbers; Scientific Notation (ios::scientific, ios::fixed) |
|
|
771 | (1) |
|
Uppercase/Lowercase Control (ios::uppercase) |
|
|
772 | (1) |
|
Setting and Resetting the Format Flags (flags, setiosflags, resetiosflags) |
|
|
772 | (2) |
|
|
774 | (2) |
|
Typing an Output Stream to an Input Stream |
|
|
776 | (12) |
|
|
788 | (13) |
|
|
789 | (1) |
|
|
789 | (6) |
|
Class Templates and Nontype Parameters |
|
|
795 | (1) |
|
Templates and Inheritance |
|
|
796 | (1) |
|
|
796 | (1) |
|
Templates and static Members |
|
|
797 | (4) |
|
|
801 | (33) |
|
|
802 | (2) |
|
When Exception Handling Should Be Used |
|
|
804 | (1) |
|
Other Error-Handling Techniques |
|
|
805 | (1) |
|
Basics of C++ Exception-Handling: try, throw, catch |
|
|
806 | (1) |
|
A Simple Exception-Handling Example: Divide by Zero |
|
|
806 | (3) |
|
|
809 | (1) |
|
|
810 | (3) |
|
|
813 | (2) |
|
|
815 | (1) |
|
Processing Unexpected Exceptions |
|
|
815 | (1) |
|
|
816 | (1) |
|
Constructors, Destructors and Exception Handling |
|
|
817 | (1) |
|
Exceptions and Inheritance |
|
|
818 | (1) |
|
|
818 | (4) |
|
Class auto_ptr and Dynamic Memory Allocation |
|
|
822 | (2) |
|
Standard Library Exception Hierarchy |
|
|
824 | (10) |
|
Introduction to Java Applications and Applets |
|
|
834 | (54) |
|
|
835 | (1) |
|
Basics of a Typical Java Environment |
|
|
836 | (3) |
|
General Notes about Java and This Book |
|
|
839 | (1) |
|
A Simple Program: Printing a Line of Text |
|
|
840 | (8) |
|
Another Java Application: Adding Integers |
|
|
848 | (5) |
|
Sample Applets from the Java 2 Software Development Kit |
|
|
853 | (6) |
|
|
854 | (2) |
|
|
856 | (2) |
|
|
858 | (1) |
|
A Simple Java Applet: Drawing a String |
|
|
859 | (7) |
|
Two More Simple Applets: Drawing Strings and Lines |
|
|
866 | (2) |
|
Another Java Applet: Adding Integers |
|
|
868 | (20) |
|
Beyond C & C++: Operators, Methods & Arrays in Java |
|
|
888 | (58) |
|
|
889 | (1) |
|
Primitive Data Types and Keywords |
|
|
889 | (2) |
|
|
891 | (5) |
|
|
896 | (5) |
|
|
901 | (5) |
|
|
906 | (3) |
|
Example: A Game of Chance |
|
|
909 | (8) |
|
|
917 | (2) |
|
Declaring and Allocating Arrays |
|
|
919 | (1) |
|
|
920 | (9) |
|
References and Reference Parameters |
|
|
929 | (2) |
|
Multiple-Subscripted Arrays |
|
|
931 | (15) |
|
Java Object-Based Programming |
|
|
946 | (38) |
|
|
947 | (1) |
|
Implementing a Time Abstract Data Type with a Class |
|
|
948 | (8) |
|
|
956 | (1) |
|
|
956 | (4) |
|
Initializing Class Objects: Constructors |
|
|
960 | (1) |
|
Using Set and Get Methods |
|
|
961 | (7) |
|
|
968 | (3) |
|
|
971 | (1) |
|
|
971 | (13) |
|
Java Object-Oriented Programming |
|
|
984 | (53) |
|
|
985 | (2) |
|
Superclasses and Subclasses |
|
|
987 | (2) |
|
|
989 | (1) |
|
Relationship between Superclass Objects and Subclass Objects |
|
|
989 | (8) |
|
Implicit Subclass-Object-to-Superclass-Object Conversion |
|
|
997 | (1) |
|
Software Engineering with Inheritance |
|
|
997 | (2) |
|
Composition vs. Inheritance |
|
|
999 | (1) |
|
Introduction to Polymorphism |
|
|
999 | (1) |
|
Type Fields and switch Statements |
|
|
999 | (1) |
|
|
999 | (1) |
|
final Methods and Classes |
|
|
1000 | (1) |
|
Abstract Superclasses and Concrete Classes |
|
|
1000 | (1) |
|
|
1001 | (2) |
|
New Classes and Dynamic Binding |
|
|
1003 | (1) |
|
Case Study: Inheriting Interface and Implementation |
|
|
1004 | (6) |
|
Case Study: Creating and Using Interfaces |
|
|
1010 | (5) |
|
|
1015 | (11) |
|
Notes on Inner Class Definitions |
|
|
1026 | (1) |
|
Type-Wrapper Classes for Primitive Types |
|
|
1026 | (11) |
|
|
1037 | (41) |
|
|
1038 | (2) |
|
Graphics Contexts and Graphics Objects |
|
|
1040 | (1) |
|
|
1041 | (7) |
|
|
1048 | (6) |
|
Drawing Lines, Rectangles and Ovals |
|
|
1054 | (4) |
|
|
1058 | (2) |
|
Drawing Polygons and Polylines |
|
|
1060 | (3) |
|
|
1063 | (1) |
|
|
1063 | (15) |
|
Java Graphical User Interface Components |
|
|
1078 | (72) |
|
|
1079 | (2) |
|
|
1081 | (2) |
|
|
1083 | (3) |
|
|
1086 | (2) |
|
JTextField and JPasswordField |
|
|
1088 | (6) |
|
|
1093 | (1) |
|
|
1094 | (3) |
|
|
1097 | (4) |
|
|
1101 | (3) |
|
|
1104 | (2) |
|
|
1106 | (5) |
|
|
1111 | (8) |
|
|
1111 | (3) |
|
|
1114 | (3) |
|
|
1117 | (2) |
|
|
1119 | (2) |
|
Creating a Self-Contained Subclass of JPanel |
|
|
1121 | (6) |
|
|
1127 | (2) |
|
|
1129 | (21) |
|
Java Multimedia: Images, Animation and Audio |
|
|
1150 | (30) |
|
|
1151 | (1) |
|
Loading, Displaying and Scaling Images |
|
|
1152 | (3) |
|
Loading and Playing Audio Clips |
|
|
1155 | (3) |
|
Animating a Series of Images |
|
|
1158 | (4) |
|
|
1162 | (2) |
|
Customizing Applets via the HTML param Tag |
|
|
1164 | (5) |
|
|
1169 | (2) |
|
|
1171 | (3) |
|
Internet and World Wide Web Resources |
|
|
1174 | (6) |
A Internet and Web Resources |
|
1180 | (11) |
|
|
1180 | (1) |
|
|
1181 | (1) |
|
|
1182 | (1) |
|
|
1182 | (1) |
|
|
1182 | (2) |
|
|
1184 | (1) |
|
A.7 C++ Development Tools |
|
|
1185 | (1) |
|
|
1185 | (2) |
|
|
1187 | (1) |
|
|
1187 | (1) |
|
|
1187 | (1) |
|
|
1188 | (1) |
|
|
1188 | (1) |
|
|
1189 | (1) |
|
|
1189 | (2) |
B C99 Internet and Web Resources |
|
1191 | (2) |
|
|
1191 | (2) |
C Operator Precedence Charts |
|
1193 | (5) |
D ASCII Character Set |
|
1198 | (1) |
E Number Systems |
|
1199 | (13) |
|
|
1200 | (3) |
|
E.2 Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers |
|
|
1203 | (1) |
|
E.3 Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers |
|
|
1204 | (1) |
|
E.4 Converting from Binary, Octal, or Hexadecimal to Decimal |
|
|
1204 | (1) |
|
E.5 Converting from Decimal to Binary, Octal, or Hexadecimal |
|
|
1205 | (1) |
|
E.6 Negative Binary Numbers: Two's Complement Notation |
|
|
1206 | (6) |
Index |
|
1212 | |