Learn C++ programming at your own pace-Covers modern C++ 20
Starting with one hour a day, you can gain all the skills you need to begin programming in C++. This complete tutorial will help you quickly master the basics of object-oriented programming and teach you advanced C++ language features and concepts. Fully updated for the C++20 standard, this practical book is designed to help you write C++ code that's faster, simpler, and more reliable and master the fundamentals of C++ and object-oriented programming.
- No programming experience required: start writing well-organized, efficient C++ programs quickly!
- Apply proven Do's and Don'ts to leverage best practices and avoid pitfalls from day one
- Test your knowledge and expertise with focused exercises after every lesson
- Simplify your code using automatic type deduction and other features
- Accelerate learning using nearly 300 code samples explained within
- Preview improvements expected in C++23
Lessons
Part I - The Basics: Using Variables, Declaring Constants; Arrays and Strings; Expressions, Statements, and Operators; Controlling Program Flow; Functions; Pointers and References
Part II - Fundamentals of Object-Oriented C++ Programming: Classes and Objects; Implementing Inheritance; Polymorphism; Operator Types and Operator Overloading; Casting Operators; Macros and Templates
PART III - Learning the Standard Template Library (STL): The STL String Class; STL Dynamic Array Classes; STL list and forward_list; STL set and multiset; STL map and multimap
PART IV: Lambda Expressions and STL Algorithms: Function Objects; Lambda Expressions; STL Algorithms; Adaptive Containers: Stack and Queue; Bit Flags
PART V: Advanced C++ Concepts: Smart Pointers; Streams; Exception Handling; C++20 Concepts, Ranges, Views, and Adaptors; C++20 Threads; C++20 and C++23 Modules
Appendixes: Working with Numbers; C++ Keywords; Writing Great C++ Code; ASCII Codes
Autorentext
Klappentext
Inhalt
Introduction xxvi PART I: The Basics Lesson 1: Getting Started A Brief History of C++ Connection to C Advantages of C++ Evolution of the C++ Standard Who Uses Programs Written in C++? Programming a C++ Application Steps in Building an Executable Analyzing Errors and Debugging Integrated Development Environments Programming Your First C++ Application Building and Executing Your First C++ Application Understanding Compiler Errors What's New in C++20? Summary Q&A Workshop Quiz Exercises Lesson 2: The Anatomy of a C++ Program Parts of the Hello World Program Preprocessor Directive #include The Body of Your Program: main() Returning a Value The Concept of Namespaces Comments in C++ Code Functions in C++ Basic Input Using std::cin and Output Using std::cout Summary Q&A Workshop Quiz Exercises Lesson 3: Using Variables, Declaring Constants What Is a Variable? Memory and Addressing in Brief Declaring Variables to Access and Use Memory Declaring and Initializing Multiple Variables of a Type Understanding the Scope of a Variable Global Variables Naming Conventions Common Compiler-Supported C++ Variable Types Using Type bool to Store Boolean Values Using Type char to Store Character Values The Concept of Signed and Unsigned Integers Signed Integer Types short, int, long, and long long Unsigned Integer Types unsigned short, unsigned int, unsigned long, and unsigned long long Avoiding Overflow Errors by Selecting Correct Data Types Floating-Point Types float and double Determining the Size of a Variable by Using sizeof() Avoid Narrowing Conversion Errors by Using List Initialization Automatic Type Inference Using auto Using typedef to Substitute a Variable's Type What Is a Constant? Literal Constants Declaring Variables as Constants Using const Constant Expressions Using constexpr C++20 Immediate Functions Using consteval Enumerations Scoped Enumerations Defining Constants by Using #define Keywords You Cannot Use as Variable or Constant Names Summary Q&A Workshop Quiz Exercises Lesson 4: Managing Arrays and Strings What Is an Array? The Need for Arrays Declaring and Initializing Static Arrays How Data Is Stored in an Array Accessing Data Stored in an Array Modifying Data Stored in an Array Multidimensional Arrays Declaring and Initializing Multidimensional Arrays Accessing Elements in a Multidimensional Array Dynamic Arrays C-Style Character Strings C++ Strings: Using std::string Summary Q&A Workshop Quiz Exercises Lesson 5: Working with Expressions, Statements, and Operators Statements Compound Statements, or Blocks Using Operators The Assignment Operator (=) Understanding l-Values and r-Values Operators to Add (+), Subtract (-), Multiply (*), Divide (/), and Modulo Divide (%) Operators to Increment (++) and Decrement (--) To Postfix or to Prefix? Equality Operators (== and !=) Relational Operators C++20 Three-Way Comparison Operator (<=>) Logical Operations NOT, AND, OR, and XOR Using C++ Logical Operators NOT (!), AND (&&), and OR (||) Bitwise NOT (~), AND (&), OR (|), and XOR (^) Operators Bitwise Right Shift (>>) and Left Shift (<<) Operators Compound Assignment Operators Using the si…