We use cookies to provide essential features and services. By using our website you agree to our use of cookies .

×

COVID-19 Response at Fishpond

Read what we're doing...

Sams Teach Yourself C++ in 21 Days
By

Rating

Product Description
Product Details

Table of Contents

Introduction. Who Should Read This Book Conventions Used in This Book Sample Code for This Book Week 1 At a Glance A Note to C Programmers Where You Are Going1. Getting Started. A Brief History of C++ The Need for Solving Problems Procedural, Structured, and Object-Oriented Programming Object-Oriented Programming (OOP) C++ and Object-Oriented Programming How C++ Evolved Should I Learn C First? C++, Java, and C# Microsoft's Managed Extensions to C++ The ANSI Standard Preparing to Program Your Development Environment The Process of Creating the Program Creating an Object File with the Compiler Creating an Executable File with the Linker The Development Cycle HELLO.cpp-Your First C++ Program Getting Started with Your Compiler Building the Hello World Project Compile Errors Summary Q&A Workshop Quiz Exercises2. The Anatomy of a C++ Program. A Simple Program A Brief Look at cout Using the Standard Namespace Commenting Your Programs Types of Comments Using Comments A Final Word of Caution About Comments Functions Using Functions Methods Versus Functions Summary Q&A Workshop Quiz Exercises3. Working with Variables and Constants. What Is a Variable? Storing Data in Memory Setting Aside Memory Size of Integers signed and unsigned Fundamental Variable Types Defining a Variable Case Sensitivity Naming Conventions Keywords Creating More Than One Variable at a Time Assigning Values to Your Variables Creating Aliases with typedef When to Use short and When to Use long Wrapping Around an unsigned Integer Wrapping Around a signed Integer Working with Characters Characters and Numbers Special Printing Characters Constants Literal Constants Symbolic Constants Enumerated Constants Summary Q&A Workshop Quiz Exercises4. Creating Expressions and Statements. Starting with Statements Using Whitespace Blocks and Compound Statements Expressions Working with Operators Assignment Operators Mathematical Operators Combining the Assignment and Mathematical Operators Incrementing and Decrementing Prefixing Versus Postfixing Understanding Operator Precedence Nesting Parentheses The Nature of Truth Evaluating with the Relational Operators The if Statement Indentation Styles The else Statement Advanced if Statements Using Braces in Nested if Statements Using the Logical Operators The Logical AND Operator The Logical OR Operator The Logical NOT Operator Short Circuit Evaluation Relational Precedence More About Truth and Falsehood The Conditional (Ternary) Operator Summary Q&A Workshop Quiz Exercises5. Organizing into Functions. What Is a Function? Return Values, Parameters, and Arguments Declaring and Defining Functions Function Prototypes Defining the Function Execution of Functions Determining Variable Scope Local Variables Local Variables Within Blocks Parameters Are Local Variables Global Variables Global Variables: A Word of Caution Considerations for Creating Function Statements More About Function Arguments More About Return Values Default Parameters Overloading Functions Special Topics About Functions Inline Functions Recursion How Functions Work-A Peek Under the Hood Levels of Abstraction Summary Q&A Workshop Quiz Exercises6. Understanding Object-Oriented Programming. Is C++ Object-Oriented? Creating New Types Introducing Classes and Members Declaring a Class A Word on Naming Conventions Defining an Object Classes Versus Objects Accessing Class Members Assigning to Objects, Not to Classes If You Don't Declare It, Your Class Won't Have It Private Versus Public Access Making Member Data Private Implementing Class Methods Adding Constructors and Destructors Getting a Default Constructor and Destructor Using the Default Constructor Including const Member Functions Interface Versus Implementation Where to Put Class Declarations and Method Definitions Inline Implementation Classes with Other Classes as Member Data Exploring Structures Summary Q&A Workshop Quiz Exercises7. More on Program Flow. Looping The Roots of Looping: goto Why goto Is Shunned Using while Loops Exploring More Complicated while Statements Introducing continue and break Examining while (true) Loops Implementing do...while Loops Using do...while Looping with the for Statement Advanced for Loops Empty for Loops Nesting Loops Scoping in for Loops Summing Up Loops Controlling Flow with switch Statements Using a switch Statement with a Menu Summary Q&A Workshop Quiz Exercises Week 1 In Review Week 2 At a Glance Where You Are Going8. Understanding Pointers. What Is a Pointer? A Bit About Memory Getting a Variable's Memory Address Storing a Variable's Address in a Pointer Pointer Names Getting the Value from a Variable Dereferencing with the Indirection Operator Pointers, Addresses, and Variables Manipulating Data by Using Pointers Examining the Address Why Would You Use Pointers? The Stack and the Free Store (Heap) Allocating Space with the new Keyword Putting Memory Back: The delete Keyword Another Look at Memory Leaks Creating Objects on the Free Store Deleting Objects from the Free Store Accessing Data Members Creating Member Data on the Free Store The this Pointer Stray, Wild, or Dangling Pointers Using const Pointers const Pointers and const Member Functions Using a const this Pointers Summary Q&A Workshop Quiz Exercises9. Exploiting References. What Is a Reference? Using the Address-Of Operator (&) on References Attempting to Reassign References (Not!) Referencing Objects Null Pointers and Null References Passing Function Arguments by Reference Making swap() Work with Pointers Implementing swap() with References Understanding Function Headers and Prototypes Returning Multiple Values Returning Values by Reference Passing by Reference for EfficiencyPassing a const PointerReferences as an Alternative Knowing When to Use References Versus Pointers Mixing References and Pointers Returning Out-of-Scope Object References Returning a Reference to an Object on the Heap Pointer, Pointer, Who Has the Pointer? Summary Q&A Workshop Quiz Exercises10. Working with Advanced Functions. Overloaded Member Functions Using Default Values Choosing Between Default Values and Overloaded Functions The Default Constructor Overloading Constructors Initializing Objects The Copy Constructor Operator Overloading Writing an Increment Function Overloading the Prefix Operator Returning Types in Overloaded Operator Functions Returning Nameless Temporaries Using the this Pointer Overloading the Postfix Operator Difference Between Prefix and Postfix Overloading Binary Mathematical Operators Issues in Operator Overloading Limitations on Operator Overloading What to Overload The Assignment Operator Handling Data Type Conversion Conversion Operators Summary Q&A Workshop Quiz Exercises11. Object-Oriented Analysis and Design. Building Models Software Design: The Modeling Language Software Design: The Process Waterfall Versus Iterative Development The Process of Iterative Development Step 1: The Conceptualization Phase: Starting with The Vision Step 2: The Analysis Phase: Gathering Requirements Use Cases Application Analysis Systems Analysis Planning Documents Visualizations Artifacts Step 3: The Design Phase What Are the Classes? Transformations Other Transformations Building the Static Model Dynamic Model Steps 4-6: Implementation, Testing, and Rollout? Iterations Summary Q&A Workshop Quiz Exercises12. Implementing Inheritance. What Is Inheritance? Inheritance and Derivation The Animal Kingdom The Syntax of Derivation Private Versus Protected Inheritance with Constructors and Destructors Passing Arguments to Base Constructors Overriding Base Class Functions Hiding the Base Class Method Calling the Base Method Virtual Methods How Virtual Functions Work Trying to Access Methods from a Base Class Slicing Creating Virtual Destructors Virtual Copy Constructors The Cost of Virtual Methods Summary Q&A Workshop Quiz Exercises13. Managing Arrays and Strings. What Is an Array? Accessing Array Elements Writing Past the End of an Array Fence Post Errors Initializing Arrays Declaring Arrays Using Arrays of Objects Declaring Multidimensional Arrays Initializing Multidimensional Arrays Building Arrays of Pointers A Look at Pointer Arithmetic-An Advanced Topic Declaring Arrays on the Free Store A Pointer to an Array Versus an Array of Pointers Pointers and Array Names Deleting Arrays on the Free Store Resizing Arrays at Runtime char Arrays and Strings Using the strcpy() and strncpy() Methods String Classes Linked Lists and Other Structures Creating Array Classes Summary Q&A Workshop Quiz Exercises14. Polymorphism. Problems with Single Inheritance Percolating Upward Casting Down Adding to Two Lists Multiple Inheritance The Parts of a Multiply Inherited Object Constructors in Multiply Inherited Objects Ambiguity Resolution Inheriting from Shared Base Class Virtual Inheritance Problems with Multiple Inheritance Mixins and Capabilities Classes Abstract Data Types Pure Virtual Functions Implementing Pure Virtual Functions Complex Hierarchies of Abstraction Which Classes Are Abstract? Summary Q&A Workshop Quiz Exercises Week 2 In Review Week 3 At a Glance Where You Are Going15. Special Classes and Functions. Sharing Data Among Objects of the Same Type: Static Member Data Using Static Member Functions Pointers to Functions Why Use Function Pointers? Arrays of Pointers to Functions Passing Pointers to Functions to Other Functions Using typedef with Pointers to Functions Pointers to Member Functions Arrays of Pointers to Member Functions Summary Q&A Workshop Quiz Exercises16. Advanced Inheritance. Aggregation Accessing Members of the Aggregated Class Controlling Access to Aggregated Members Cost of Aggregation Copying by Value Implementation in Terms of Inheritance Versus Aggregation/Delegation Using Delegation Private Inheritance Adding Friend Classes Friend Functions Friend Functions and Operator Overloading Overloading the Insertion Operator Summary Q&A Workshop Quiz Exercises17. Working with Streams. Overview of Streams Encapsulation of Data Flow Understanding Buffering Streams and Buffers Standard I/O Objects Redirection of the Standard Streams Input Using cin Inputting Strings String Problems The cin Return Value Other Member Functions of cin Single Character Input Getting Strings from Standard Input Using cin.ignore() Peeking at and Returning Characters: peek() and putback() Outputting with cout Flushing the Output Functions for Doing Output Manipulators, Flags, and Formatting Instructions Streams Versus the printf() Function File Input and Output Using the ofstream Condition States Opening Files for Input and Output Changing the Default Behavior of ofstream on Open Binary Versus Text Files Command-line Processing Summary Q&A Workshop Quiz Exercises18. Creating and Using Namespaces. Getting Started Resolving Functions and Classes by Name Visibility of Variables Linkage Static Global Variables Creating a Namespace Declaring and Defining Types Defining Functions Outside a Namespace Adding New Members Nesting Namespaces Using a Namespace The using Keyword The using Directive The using Declaration The Namespace Alias The Unnamed Namespace The Standard Namespace std Summary Q&A Workshop Quiz Exercises19. Templates. What Are Templates? Building a Template Definition Using the Name Implementing the Template Passing Instantiated Template Objects to Functions Templates and Friends Nontemplate Friend Classes and Functions General Template Friend Class or Function Using Template Items Using Specialized Functions Static Members and Templates The Standard Template Library Using Containers Understanding Sequence Containers Understanding Associative Containers Working with the Algorithm Classes Summary Q&A Workshop Quiz Exercises20. Handling Errors and Exceptions. Bugs, Errors, Mistakes, and Code Rot Exceptional Circumstances The Idea Behind Exceptions The Parts of Exception Handling Causing Your Own Exceptions Creating an Exception Class Placing try Blocks and catch Blocks How Catching Exceptions Work Using More Than One catch Specification Exception Hierarchies Data in Exceptions and Naming Exception Objects Exceptions and Templates Exceptions Without Errors A Word About Code Rot Bugs and Debugging Breakpoints Watch Points Examining Memory Assembler Summary Q&A Workshop Quiz Exercises21. What's Next. The Preprocessor and the Compiler The #define Preprocessor Directive Using #define for Constants Using #define for Tests The #else Precompiler Command Inclusion and Inclusion Guards Macro Functions Why All the Parentheses? String Manipulation Stringizing Concatenation Predefined Macros The assert() Macro Debugging with assert() Using assert() Versus Exceptions Side Effects Class Invariants Printing Interim Values Inline Functions Bit Twiddling Operator AND Operator OR Operator Exclusive OR The Complement Operator Setting Bits Clearing Bits Flipping Bits Bit Fields Programming Style Indenting Braces Long Lines and Function Length Structuring switch Statements Program Text Naming Identifiers Spelling and Capitalization of Names Comments Setting Up Access Class Definitions include Files Using assert() Making Items Constant with const Next Steps in Your C++ Development Where to Get Help and Advice Related C++ Topics: Managed C++, C#, and Microsoft's .NET Staying in Touch Summary Q&A Workshop Quiz Exercises Week 3 In ReviewA. Working with Numbers: Binary and Hexadecimal. Using Other Bases Converting to Different Bases Binary Why Base 2? Bits, Bytes, and Nybbles What's a KB? Binary Numbers HexadecimalB. C++ Keywords.C. Operator Precedence.D. Answers. Day 1 Quiz Exercises Day 2 Quiz Exercises Day 3 Quiz Exercises Day 4 Quiz Exercises Day 5 Quiz Exercises Day 6 Quiz Exercises Day 7 Quiz Exercises Day 8 Quiz Exercises Day 9 Quiz Exercises Day 10 Quiz Exercises Day 11 Quiz Exercises Day 12 Quiz Exercises Day 13 Quiz Exercises Day 14 Quiz Exercises Day 15 Quiz Exercises Day 16 Quiz Exercises Day 17 Quiz Exercises Day 18 Quiz Exercises Day 19 Quiz Exercises Day 20 Quiz Exercises Day 21 Quiz ExercisesE. A Look at Linked Lists. The Component Parts of Your Linked ListIndex.

Promotional Information

Sams Teach Yourself C++ in 21 Days, Fifth Edition is a hands-on guide to the C++ programming language. Numerous examples of syntax and detailed analysis of code provide an excellent guide for beginning programmers. Readers will learn about such fundamentals as managing I/O, loops and arrays, object-oriented programming, templates, and creating C++ applications, all in well-structured and easy-to-follow lessons. Lessons provide sample listings, complete with sample output and an analysis of the code, to illustrate the topics of the day. This new edition has been updated to the new ANSI/ISO C++ Standard and includes coverage of namespaces, the Standard Template Library and distributed computing. This edition is non-compiler specific and has received a double technical edit to ensure code integrity.

About the Author

Jesse Liberty is the author of numerous books on software development, including best-selling titles in C++ and .NET. He is the president of Liberty Associates, Inc. (http://www.LibertyAssociates.com) where he provides custom programming, consulting, and training.Bradley Jones, Microsoft MVP, Visual C++, can be referred to as a webmaster, manager, coding grunt, executive editor, and various other things. His time and focus are on a number of software development sites and channels, including Developer.com, CodeGuru.com, DevX, VBForums, Gamelan, and other Jupitermedia-owned sites. This influence expands over sites delivering content to over 2.5 million unique developers a month.His expertise is in the area of the big "C"s-C, C++, and C#-however, his experience includes development in PowerBuilder, VB, some Java, ASP, COBOL I/II, and various other technologies too old to even mention now. He has also been a consultant, analyst, project lead, associate publisher for major technical publishers, and author. His recent authoring credits include Sams Teach Yourself the C# Language in 21 Days, a 6th edition of Sams Teach Yourself C in 21 Days, and now this edition of Sams Teach Yourself C++ in 21 Days. He is also the cofounder and president of the Indianapolis .NET Developers Association, which is a charter INETA group with membership of over 700. You can often hear his ramblings on the CodeGuru.com or VBForums.com discussion forums, and he also does the weekly CodeGuru newsletter that goes out to tens of thousands of developers.

(c) Copyright Pearson Education. All rights reserved.

Ask a Question About this Product More...
Write your question below:
Look for similar items by category
Home » Books » Computers » Programming » C++
Item ships from and is sold by Fishpond.com, Inc.
Back to top