Ⅰ A Quick Start to C and C++ Programming1 THE VISUAL C++ COMPILER PACKAGE 3
Recommended Hardware, 4
Selecting the Correct Install Options, 6
A Typical Windows Installation, 8
Documentation, 9
The Development System, 10
Acknowledgments, 13
Important Compiler Features, 14
Introduction, 15
Compiler Options, 18
What's Next?, 22
2 GETTING STARTED WITH THE VISUAL C++ WORKBENCH 25
Accessing Context-Sensitive Help, 26
Starting the Visual C++ Workbench, 26
Understanding Menus, 27
The File Menu, 28
The Edit Menu, 33
The Search Menu, 35
The Project Menu, 39
The Resource Menu, 43
The Debug Menu, 44
The Tools Menu, 49
The Window Menu, 52
The Help Menu, 53
What's Next?, 54
3 WRITING AND COMPILING SIMPLE C/C++ PROGRAMS 57
Entering Your First Program, 58
Launching the Visual C++ Workbench, 58
Editing Your First Program, 60
Saving Your First Program, 61
Building Your First Program, 62
Debugging Your First Program, 66
Running Your Program, 75
Setting Break Points, 78
What's Next?, 82
4 ADVANCED VISUAL C++ FEATURES 85
Custom Icons,Cursors,and Bitmaps, 86
Books Online, 91
ZoomIn, 94
Debugging and Testing, 95
What's Next?, 100
Ⅱ C and C++ Programming Foundations5 CAND C++ FOUNDATIONS 103
History of C, 104
The ANSI C Standard, 112
The Evolution of C++ and Object-oriented Programming, 114
History of C++, 115
The Basic Elements of a C Program, 122
6 DATA 139
Identifiers, 140
Keywords, 143
Standard C and C++ Data Types, 144
Access Modifiers, 153
pascal,cdecl,near,far,and huge Modifiers, 156
Data Type Conversions, 159
Storage Classes, 162
Operators, 167
Understanding Operator Precedence Levels, 178
Standard C and C++ Libraries, 179
7 CONTROL 185
Conditional Statements, 186
Loop Statements, 204
8 WRITING AND USING FUNCTIONS 227
Function Prototyping and Style, 229
Function Arguments, 237
Function Types, 247
Arguments for Function main(), 254
Important C++ Features, 259
Problems Encountered with Scope Rules, 264
9 ARRAYS 271
What Is an Array?, 272
Arrays and C, 272
Array Declarations, 273
Array Initialization, 274
Accessing Array Elements, 278
Calculating Array Dimensions(sizeof()), 280
Array Index Out of Bounds, 283
Output and Input of Strings, 284
Multidimensional Arrays, 287
Arrays as Function Arguments, 290
String Functions and Character Arrays, 299
10 POINERS 309
Defining Pointer Variables, 310
Pointers to Functions, 335
Dynamic Memory, 339
Pointers and Arrays, 346
The C++ Reference Type, 360
11 COMPLETE I/O IN C 365
Stream Functions, 369
Low-level Input and Output in C, 374
Character Input and Output, 375
String Input and Output, 378
Integer Input and Output, 380
Formatting Output, 383
Using fseek(),ftell(),and rewind(), 388
Formatting Input, 394
12 AN INTRODUCTION TO I/O IN C++ 399
Streamlining I/O with C++, 400
From stream.h to iostream.h, 410
13 STRUCTURES,UNIONS,AND MISCELLANEOUS ITEMS 429
C and C++ Structures, 430
Unions, 454
Miscellaneous Items, 457
14 ADVANCED C AND C++ PROGRAMMING TOPICS 465
Type Compatibility, 466
Macros, 470
Advanced Preprocessor Statements, 476
Conditional Compilation, 481
Advanced Preprocessor Operators, 483
Proper Use of Header Files, 485
Making Header Files More Efficient, 486
Precompiled Header Files, 487
limits.h and float.h, 487
Handling Errors:perror(), 488
Memory Models, 490
Dynamic Memory Allocation:Linked Lists, 492
Ⅲ Foundations for Object-Oriented Programming in C++15 AN INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING 501
There Is Nothing New Under the Sun, 502
Traditional Structured Programming, 503
Object-oriented Programming, 504
C++ and Object-oriented Programming, 505
Object-oriented Terminology, 506
A First Look at the C++ Class, 509
16 C++ CLASSES 523
Additional Class Features, 524
Using Operator Overloading, 547
Derived Classes, 551
17 COMPLETE I/O IN C++ 559
enum Types, 560
Reference Variables, 561
Default Arguments, 564
memset(), 565
Formatting Output, 566
C/C++ I/O Options, 571
iostream Class List, 572
Binary Files, 585
Combining C and C++ Code Using extern"C", 587
Writing Your Own Manipulators, 589
18 WORKING IN AN OBJECT-ORIENTED ENVIRONMENT 597
An Object-oriented Stack in C++, 598
An Object-oriented Linked List in C++, 602
More Object-oriented C++, 621
Ⅳ System Access,Libraries,and Mixed Language Interface19 POWER PROGRAMMING:TAPPING IMPORTANT C AND C++ LIBRARIES 625
Microsoft C and C++ Header Files, 626
The Standard Library Functions(stdlib.h), 627
The Character Functions(ctype.h), 637
The String Functions(string.h), 643
The Math Functions(math.h), 652
The Time Functions(time.h), 655
System-dependent Functions, 662
20 BINDING MICROSOFT C/C++ AND ASSEMBLY LANGUAGE 673
Inline Assembly Language, 674
Creating C/C++ and Assembly Language Modules, 681
Ⅴ Windows Programming Foundations21 GENERIC CONCEPTS AND TOOLS FOR WINDOWS 701
The Language of Windows, 702
Windows Programming:Concepts and Vocabulary, 712
The Microsoft Visual C++ Windows Tools, 727
22 PROCEDURE-ORIENTED DEVELOPMENT:WRITING WINDOWS APPLICATIONS IN C 751
A Framework for All Applications, 752
Make or project Utility?, 768
A Simple Application and Template, 770
Using the SWA to Develop a Sine Wave Application, 779
Creating a Windows Pie Chart Application, 784
More on Traditional C Windows Programming, 799
23 OBJECT-ORIENTED DEVELOPMENT:THE FOUNDATION CLASS LIBRARY 801
The Need for a Foundation Class Library, 803
Foundation Class Library Design Considerations, 803
Key Foundation Class Library Features, 804
It All Begins with CObject, 805
Important Foundation Library Classes, 808
A Simplified Application, 809
A Simplified Design Ensures Easy Maintenance, 815
24 OBJECT-ORIENTED DEVELOPMENT:WRITING FOUNDATION CLASS LIBRARY APPLICATIONS IN C++ 817
A Simple Application and Template, 818
Drawing Graphics Primitives in a Window, 823
A Scientific Waveform with a Menu and Dialog Boxes, 831
A Bar Chart with a Menu and Dialog Boxes, 849
Ⅳ Windows NT Programming Techniques25 WINDOWS NT:WRITING SIMPLE APPLICATIONS 871
Important Changes for Porting to Windows NT, 873
The NTSWP Application Template, 875
Adding Resources, 888
26 WRITING FOUNDATION CLASS LIBRARY APPLICATIONS FOR THE WINDOWS NT ENVIRONMENT 903
Why Use a Class Library with Windows NT?, 904
Microsoft Foundation Class Library Features That Apply to Windows NT, 905
A Simple MFC Application That Experiments with Several Graphics Drawing Primitives, 906
A Scientific Plot with Resources:Menu,Dialog Box,and Multimedia Sound, 913
A Business Chart with Resources:Menu,Dialog Box,and Multimedia Sound, 930
What's Left?, 949
Ⅶ Wizards27 APPLICATION AND CLASS WIZARDS 953
Using Wizards, 955
Building the Application, 962
Working with AppWizard-Generated Code, 964
Example #1:Drawing in the Client Area, 975
Example #2:A Simple Word Processor, 980
Working with AppWizard-Generated Code, 986
What's Next?, 1000
28 AN INTRODUCTION TO OBJECT LINKING AND EMBEDDING(OLE) 1003
New OLE Features and Specifications, 1005
Building a Container Application, 1012
Building a Server Application, 1035
Working with the Container and Server Applications, 1056
What Now?, 1059
Ⅷ AppendixesA EXTENDED ASCII TABLE 1063
B DOS 10H,21H,AND 33H INTERRUPT PARAMETERS 1071
Interface Control of the CRT, 1072
Screen Control with BIOS-type 10H Interrupts, 1072
Handling Characters, 1073
Graphics Interface, 1074
ASCII Teletype Output, 1074
Specifications and Requirements for the DOS 21 H Interrupt, 1075
Mouse Control Functions Accessed Through Interrupt 33H, 1080
C CREATING DYNAMIC LINK LIBRARIES 1085
Creating a Dynamic Link Library, 1086
Creating an Application That Calls a DLL, 1089
D CREATING CUSTOM CONTROLS FOR WINDOWS 1097
A Custom Control in a DLL, 1098
An Application That Uses a Custom Control, 1106
Testing the Custom Control, 1112
INDEX 1115