C++ All-in-One For Dummies
Häftad, Engelska, 2021
479 kr
Beställningsvara. Skickas inom 10-15 vardagar
Fri frakt för medlemmar vid köp för minst 249 kr.Get ready for C++20 with all you need to know for complete mastery! Your comprehensive and updated guide to one of the world’s most popular programming languages is here! Whether you’re a novice or expert, you’ll find what you need to get going with the latest features of C++20. The workhorse of programming languages, C++ gives you the utmost control of data usage and interface and resource allocation. If your job involves data, proficiency in C++ means you’re indispensable!This edition gives you 7 books in 1 for total C++ mastery. Inside, internationally renowned expert John Paul Mueller takes you from the fundamentals of working with objects and classes to writing applications that use paradigms not normally associated with C++, such as those used for functional programming strategies. The book also includes online resources such as source code. You discover how to use a C++ GNU compiler to build applications and even how to use your mobile device for coding. Conquer advanced programming and troubleshooting Streamline your code with lambda expressionsUse C++ where you need it: for gaming, enterprise applications, and Web servicesUncover object secrets including the use of design patterns Discover how to use functional programming techniques to make code concise and easy to readIf you want to be your organization’s C++ guru, C++ All-In-One for Dummies is where it’s at!
Produktinformation
- Utgivningsdatum2021-02-25
- Mått185 x 231 x 56 mm
- Vikt1 179 g
- FormatHäftad
- SpråkEngelska
- Antal sidor912
- Upplaga4
- FörlagJohn Wiley & Sons Inc
- ISBN9781119601746
Tillhör följande kategorier
John Paul Mueller has produced 116 books and more than 600 articles on a range of topics that include functional programming techniques, application devel- opment using C++, and machine learning methodologies.
- Introduction 1About This Book 1Foolish Assumptions 4Icons Used in This Book 4Beyond the Book 5Where to Go from Here 6Book 1: Getting Started with C++ 7Chapter 1: Configuring Your Desktop System 9Obtaining a Copy of C++ 20 10Obtaining Code::Blocks 11Installing Code::Blocks 12Working with Windows 12Working with Mac OS X 13Using the standard Linux installation 14Using the graphical Linux installation 15Touring the Essential Code::Blocks Features 17Starting Code::Blocks for the first time 18Opening the sample projects 19Viewing the essential windows 20Using Other IDEs 25Chapter 2: Configuring Your Mobile System 27Obtaining CppDroid 28Understanding why CppDroid is such a great choice 29Getting your copy of CppDroid 31Ensuring you get a good install 32Considering Other Alternatives 32Working with C4Droid 33Getting multiple language support with AIDE 33Using web-based IDEs 34Touring the Essential CppDroid Features 35Getting started with CppDroid 35Accessing an example 37Working with a simple online project 37Accessing your source code 38Considering differences with the desktop environment 39Obtaining CppDroid Help 40Working with the Help documentation 40Getting community support 41Using the free examples 42Accessing the tutorials 43Chapter 3: Creating Your First C++ Application 45Code::Blocks Creating a Project 46Understanding projects 46Defining your first project 47Building and executing your first application 52Typing the Code 53Starting with Main 55Showing Information 55Doing some math 60Tabbing your output 66Let Your Application Run Away 67Chapter 4: Storing Data in C++ 69Putting Your Data Places: Variables 70Creating an integer variable 70Declaring multiple variables 73Changing values 74Setting one variable equal to another 74Initializing a variable 75Creating a great name for yourself 76Manipulating Integer Variables 78Adding integer variables 78Subtracting integer variables 82Multiplying integer variables 84Dividing integer variables 86Characters 88Null character 89Nonprintable and other cool characters 89Strings 93Getting a part of a string 94Changing part of a string 95Adding onto a string 96Adding two strings 97Making Decisions Using Conditional Operators 98Telling the Truth with Boolean Variables 100Reading from the Console 102Chapter 5: Directing the Application Flow 105Doing This or Doing That 106Evaluating Conditions in C++ 107Finding the right C++ operators 108Combining multiple evaluations 110Including Evaluations in C++ Conditional Statements 111Deciding what if and also what else 112Going further with the else and if 113Repeating Actions with Statements That Loop 115Understanding how computers use loops 116Looping situations 116Looping for 117Performing a simple for loop 118Using multiple initialization variables 123Working with ranges 126Placing a condition within the declaration 128Letting C++ determine the type 129Looping while 130Doing while 132Breaking and continuing 133Breaking 134Continuing 135Nesting loops 136Chapter 6: Dividing Your Work with Functions 139Dividing Your Work 139Calling a Function 144Passing a variable 146Passing multiple variables 147Writing Your Own Functions 148Defining the AddOne() function 149Seeing how AddOne() is called 150Taking the AddOne() Function apart 150Considering the AddOne() parameter 151Understanding the AddOne() name and type 152Improving On the Basic Function 153Using multiple parameters or no parameters 153Returning nothing 156Keeping your variables local 157Forward references and function prototypes 159Writing two versions of the same function 161Calling All String Functions 163Inserting a string into a string 163Removing parts of a string 164Replacing parts of a string 164Using the string functions together 164Understanding main() 165Chapter 7: Splitting Up Source Code Files 169Creating Multiple Source Files 170Adding a new source code file 170Removing an existing source code file 173Creating a project with multiple existing files 173Getting multiple files to interact 177Sharing with Header Files 179Adding the header only once 182Using angle brackets or quotes 182Sharing Variables among Source Files 183Using the Mysterious Header Wrappers 185Chapter 8: Referring to Your Data Through Pointers 187Understanding the Changes in Pointers for C++ 20 188Avoiding broken code 188Considering the issues 189Writing cleaner and less bug-prone code 191Heaping and Stacking the Variables 192Getting a variable’s address 196Changing a variable by using a pointer 198Pointing at a string 200Pointing to something else 203Tips on pointer variables 204Creating New Raw Pointers 205Using new 206Using an initializer 208Freeing Raw Pointers 209Working with Smart Pointers 211Creating smart pointers using std::unique_ptr and std::shared_ptr 212Defining nullable values using std::optional and std::nullopt 216Passing Pointer Variables to Functions 218Returning Pointer Variables from Functions 221Part 2: Understanding Objects and Classes 225Chapter 1: Working with Classes 227Understanding Objects and Classes 227Classifying classes and objects 230Describing methods and data 231Implementing a class 232Separating method code 237The parts of a class 240Working with a Class 241Accessing members 241Using classes and raw pointers 244Using classes and smart pointers 248Passing objects to functions 249Using const parameters in functions 251Using the this pointer 252Overloading methods 256Starting and Ending with Constructors and Destructors 259Starting with constructors 259Ending with destructors 260Sampling constructors and destructors 260Adding parameters to constructors 263Building Hierarchies of Classes 264Creating a hierarchy in C++ 265Understanding types of inheritance 266Creating and Using Object Aliases 267Chapter 2: Using Advanced C++ Features 269Filling Your Code with Comments 270Converting Types 272Understanding how int and string conversions work 272Seeing int and string conversions in action 273Considering other conversion issues 276Reading from the Console 277Understanding Preprocessor Directives 282Understanding the basics of preprocessing 282Creating constants and macros with #define 283Performing conditional compilation 286Exercising the basic preprocessor directives 288Using Constants 292Using Switch Statements 295Supercharging enums with Classes 298Working with Random Numbers 300Storing Data in Arrays 302Declaring and accessing an array 303Arrays of pointers 304Passing arrays to functions 306Adding and subtracting pointers 307Chapter 3: Planning and Building Objects 309Recognizing Objects 310Observing the Mailboxes class 312Observing the Mailbox class 314Finding other objects 315Encapsulating Objects 316Considering the Application Programming Interface 316Understanding properties 316Choosing between private and protected 318Defining a process 318Implementing properties 319Building Hierarchies 322Establishing a hierarchy 322Protecting members when inheriting 324Overriding methods 330Specializing with polymorphism 332Getting abstract about things 333Chapter 4: Building with Design Patterns 335Delving Into Pattern History 336Introducing a Simple Pattern: the Singleton 337Using an existing pattern 337Creating a singleton pattern class 338Watching an Instance with an Observer 341Understanding the observer pattern 341Defining an observer pattern class 343Observers and the Standard C++ Library 346Automatically adding an observer 347Mediating with a Pattern 349Defining the mediator pattern scenario 350Outlining the car example 351Creating the car example 354Book 3: Understanding Functional Programming 367Chapter 1: Considering Functional Programming 369Understanding How Functional Programming Differs 370Defining an Impure Language 373Considering the requirements 373Understanding the C++ functional limitations 374Seeing Data as Immutable 375Working with immutable variables 376Working with immutability in classes and structures 377Creating constant expressions 378Considering the Effects of State 381Eliminating Side Effects 382Contrasting declarations and functions 383Associating functions with side effects 384Removing side effects 385Creating a declarative C++ example 387Understanding the Role of auto 388Passing Functions to Functions 390Seeing a simple example of function input 391Using transforms 393Using Lambda Expressions for Implementation 394Chapter 2: Working with Lambda Expressions 397Creating More Readable and Concise C++ Code 398Defining the Essential Lambda Expression 399Defining the parts of a lambda expression 399Relying on computer detection of return type 401Using the auto keyword with lambda expressions 404Using lambda expressions as macros 405Developing with Lambda Expressions 406Using lambda expressions with classes and structures 407Working with the capture clause 408Sorting data using a lambda expression 411Specifying that the lambda expression throws exceptions 413Chapter 3: Advanced Lambda Expressions 415Considering the C++ 20 Lambda Extensions 416Defining an immediate function 416Using = and this in captures 417Finding other changes 418Working in Unevaluated Contexts 418Using Assignable Stateless Lambda Expressions 420Dealing with Pack Expansions 422Considering the template 422Processing the variables using recursion 423Processing the variables using a lambda expression 424Book 4: Fixing Problems 427Chapter 1: Dealing with Bugs 429It’s Not a Bug It’s a Feature! 430Make Your Application Features Look Like Features 431Anticipating (Almost) Everything 432Considering menus 432Dealing with textual input 435Performing string processing 437Avoiding Mistakes, Plain and Simple 441Chapter 2: Debugging an Application 443Programming with Debuggers 444Running the debugger 446Recognizing the parts of the Code::Blocks debugger 453Debugging with Different Tools 455Debugging a Code::Blocks Application with Command-Line Arguments 456Chapter 3: Stopping and Inspecting Your Code 457Setting and Disabling Breakpoints 458Setting a breakpoint in Code::Blocks 459Enabling and disabling breakpoints 460Watching, Inspecting, and Changing Variables 463Watching the variables 465Changing values 466Chapter 4: Traveling About the Stack 469Stacking Your Data 470Moving about the stack 471Storing local variables 473Debugging with Advanced Features 475Viewing threads 475Tracing through assembly code 475Book 5: Advanced Programming 479Chapter 1: Working with Arrays, Pointers, and References 481Building Up Arrays 482Declaring arrays 482Arrays and pointers 484Using multidimensional arrays 488Arrays and command-line parameters 492Allocating an array on the heap 494Deleting an array from the heap 494Storing arrays of pointers and arrays of arrays 495Building constant arrays 498Pointing with Pointers 498Becoming horribly complex 499Pointers to functions 505Pointing a variable to a method 506Pointing to static methods 509Referring to References 510Reference variables 510Returning a reference from a function 511Chapter 2: Creating Data Structures 515Working with Data 515The great variable roundup 516Expressing variables from either side 518Casting a spell on your data 520Comparing casting and converting 521Casting safely with C++ 523Structuring Your Data 529Structures as component data types 531Equating structures 531Returning compound data types 532Naming Your Space 534Creating a namespace 534Employing using namespace 535Using variables 537Using part of a namespace 538Chapter 3: Constructors, Destructors, and Exceptions 541Constructing and Destructing Objects 542Overloading constructors 542Initializing members 543Adding a default constructor 548Functional constructors 550Calling one constructor from another 553Copying instances with copy constructors 555When constructors go bad 557Destroying your instances 558Virtually inheriting destructors 560Programming the Exceptions to the Rule 563Creating a basic try catch block 563Using multiple catch blocks 565Throwing direct instances 566Catching any exception 567Rethrowing an exception 568Using a standard category 570Chapter 4: Advanced Class Usage 571Inherently Inheriting Correctly 572Morphing your inheritance 572Avoiding polymorphism 573Adjusting access 574Avoiding variable naming conflicts 575Using class-based access adjustment 576Returning something different, virtually speaking 577Multiple inheritance 581Virtual inheritance 584Friend classes and functions 588Using Classes and Types within Classes 591Nesting a class 591Types within classes 597Chapter 5: Creating Classes with Templates 601Templatizing a Class 602Considering types 602Defining the need for templates 602Creating and using a template 605Understanding the template keyword 607Going Beyond the Basics 609Separating a template from the function code 609Including static members in a template 611Parameterizing a Template 612Putting different types in the parameter 613Including multiple parameters 616Working with non-type parameters 619Typedefing a Template 622Deriving Templates 623Deriving classes from a class template 623Deriving a class template from a class 626Deriving a class template from a class template 627Templatizing a Function 630Overloading and function templates 632Templatizing a method 635Chapter 6: Programming with the Standard Library 637Architecting the Standard Library 638Containing Your Classes 638Storing in a vector 639Working with std::array 642Mapping your data 643Containing instances, pointers, or references 644Working with copies 648Comparing instances 649Iterating through a container 655A map of pairs in your hand 658The Great Container Showdown 658Associating and storing with a set 658Unionizing and intersecting sets 662Listing with list 664Stacking the deque 669Waiting in line with stacks and queues 670Copying Containers 673Creating and Using Dynamic Arrays 675Working with Unordered Data 677Using std::unordered_set to create an unordered set 677Manipulating unordered sets 677Working with Ranges 679Book 6: Reading and Writing Files 681Chapter 1: Filing Information with the Streams Library 683Seeing a Need for Streams 684Programming with the Streams Library 686Getting the right header file 686Opening a file 687Reading from a file 690Reading and writing a file 691Working with containers 692Handling Errors When Opening a File 693Flagging the ios Flags 695Chapter 2: Writing with Output Streams 697Inserting with the