Title Page....5
Copyright Page....6
Table of Contents....9
Introduction....13
About This Book....13
Foolish Assumptions....13
Icons Used in This Book....14
Where to Go from Here....14
Chapter 1 Compiling and Running Your First C++ Application....15
Looking at a Simple C++ Program....16
Using C++ on Microsoft Windows....16
Using C++ on Apple macOS....17
Using C++ on Linux....18
Working with an Integrated Development Environment....19
Chapter 2 Storing Data in C++....21
Storing Values in Variables....21
Creating an integer variable....22
Declaring multiple variables....24
Changing values....25
Setting one variable equal to another....26
Initializing a variable....26
Creating a great name for yourself....27
Manipulating Integer Variables....28
Adding integer variables....28
Subtracting integer variables....31
Multiplying integer variables....32
Dividing integer variables....33
Working with Character Variables....35
Null character....36
Nonprintable and other characters....36
Using Strings....37
Getting a part of a string....38
Changing part of a string....39
Adding onto a string....40
Adding two strings....40
Telling the Truth with Boolean Variables....41
Using Floating-Point Values in a Variable....42
Printing Float and Double Values....43
Making Your Code More Readable with Enumerations....45
Reading from the Console....46
Chapter 3 Directing the Application Flow....49
Filling Your Code with Comments....49
Evaluating Conditions in C++....51
Finding the right C++ relational operators....52
Combining multiple conditions....53
Using If Statements and Conditions....54
Deciding what if and also what else....55
Going further with the else and if....56
Making Decisions Using a Conditional Operator....57
Repeating Actions with Statements That Loop....59
Looping for....59
Performing a simple for loop....60
Going backward....62
Looping while....63
Doing while....65
Breaking and Continuing....66
Breaking....66
Continuing....67
Nesting Loops....68
Using Switch Statements....69
Chapter 4 Dividing Your Work with Functions....73
Dividing Your Work....73
Calling a Function....75
Passing a variable....76
Passing multiple variables....77
Writing Your Own Functions....78
Improving On the Basic Function....79
Using multiple parameters or no parameters....79
Returning nothing....81
Keeping your variables local....82
Forward references and function prototypes....84
Writing two versions of the same function....86
Calling All String Functions....88
Inserting a string into a string....88
Removing parts of a string....88
Replacing parts of a string....89
Understanding main()....89
Chapter 5 Splitting Up Source Code Files....91
Creating Multiple Source Files....91
Sharing with Header Files....94
Adding the header only once....97
Using angle brackets or quotes....97
Sharing Variables among Source Files....98
Using the Mysterious Header Wrappers....99
Using Constants....101
Understanding Preprocessor Directives....103
Understanding the basics of preprocessing....104
Creating constants with #define....105
Chapter 6 Referring to Your Data through Pointers....107
Considering the Issues with Pointers....107
Heaping and Stacking the Variables....108
Getting a variable’s address....109
Changing a variable by using a pointer....110
Pointing at a string....113
Pointing to something else....116
Getting tips on pointer variables....117
Creating New Pointers....117
Using new....118
Using an initializer....120
Freeing Pointers....120
Passing Pointer Variables to Functions....123
Returning Pointer Variables from Functions....127
Chapter 7 Working with Classes....129
Understanding Objects and Classes....129
Classifying classes and objects....130
Describing properties and behaviors....130
Implementing a class....131
Separating member function code....131
Identifying the parts of a class....137
Working with a Class....138
Accessing members....138
Using classes and pointers....140
Passing objects to functions....142
Using const parameters in functions....144
Using the this pointer....145
Defining standard this pointer usage....146
Starting and Ending with Constructors and Destructors....148
Starting with constructors....148
Ending with destructors....148
Sampling constructors and destructors....149
Adding parameters to constructors....150
Building Hierarchies of Classes....153
Overriding member functions....155
Generating random numbers....157
Using polymorphism....158
Overloading member functions....160
Chapter 8 Working with Arrays and Pointers....163
Declaring Arrays....163
Using Arrays and Pointers....165
Using Multidimensional Arrays....166
Declaring a multidimensional array....167
Considering data type....168
Initializing multidimensional arrays....168
Passing multidimensional arrays....168
Working with Arrays and Command-Line Parameters....169
Allocating an Array on the Heap....170
Deleting an Array from the Heap....170
Chapter 9 Ten Features for More Advanced C++ Programming....171
Conditional Compilation....171
Namespaces....172
File I/O....173
Exception Handling....174
Operator Overloading....176
STL Vectors....178
STL Maps....178
STL Iterators....179
Algorithms Library....180
Smart Pointers....181
Index....183
EULA....195
C++ Essentials For Dummies is your useful reference to the key concepts of C++, the popular general-purpose language utilized everywhere from building games to writing parts of operating systems. With minimal review and background material―and absolutely no fluff―this book gets straight to the essential topics you need to know to ramp up, brush up, or level up.
Great for supplementing classroom learning, reviewing for a certification, or staying knowledgeable on the job, C++ Essentials For Dummies is a fantastic refresher guide that you can always turn to for answers.