C++ in One Hour a Day, Sams Teach Yourself

Lýsing:
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.
Annað
- Höfundur: Siddhartha Rao
- Útgáfa:9
- Útgáfudagur: 2022-01-19
- Engar takmarkanir á útprentun
- Engar takmarkanir afritun
- Format:ePub
- ISBN 13: 9780137334582
- Print ISBN: 9780137334681
- ISBN 10: 0137334583
Efnisyfirlit
- Cover Page
- About This eBook
- Title Page
- Copyright Page
- Dedication Page
- Pearson’s Commitment to Diversity, Equity, and Inclusion
- Contents at a Glance
- Table of Contents
- Introduction
- Who Should Read This Book?
- Organization of This Book
- Conventions Used in This Book
- Sample Code for This Book
- About the Author
- Acknowledgments
- We Want to Hear from You!
- Reader Services
- Figure Credits
- Part I: The Basics
- Lesson 1: Getting Started
- A Brief History of C++
- Programming a C++ Application
- What’s New in C++20?
- Summary
- Q&A
- Workshop
- Lesson 2: The Anatomy of a C++ Program
- Parts of the Hello World Program
- Preprocessor Directive #include
- The Body of Your Program: main()
- 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
- Lesson 3: Using Variables, Declaring Constants
- What Is a Variable?
- Common Compiler-Supported C++ Variable Types
- Determining the Size of a Variable by Using sizeof()
- Automatic Type Inference Using auto
- Using typedef to Substitute a Variable’s Type
- What Is a Constant?
- Keywords You Cannot Use as Variable or Constant Names
- Summary
- Q&A
- Workshop
- Lesson 4: Managing Arrays and Strings
- What Is an Array?
- Multidimensional Arrays
- Dynamic Arrays
- C-Style Character Strings
- C++ Strings: Using std::string
- Summary
- Q&A
- Workshop
- Lesson 5: Working with Expressions, Statements, and Operators
- Statements
- Compound Statements, or Blocks
- Using Operators
- Summary
- Q&A
- Workshop
- Lesson 6: Controlling Program Flow
- Conditional Execution Using if...else
- Getting Code to Execute in Loops
- Modifying Loop Behavior Using continue and break
- Programming Nested Loops
- Summary
- Q&A
- Workshop
- Lesson 7: Organizing Code with Functions
- The Need for Functions
- Using Functions to Work with Different Forms of Data
- How Function Calls Are Handled by the Microprocessor
- Summary
- Q&A
- Workshop
- Lesson 8: Pointers and References Explained
- What Is a Pointer?
- Dynamic Memory Allocation
- Common Programming Mistakes When Using Pointers
- Pointer Programming Best Practices
- What Is a Reference?
- Summary
- Q&A
- Workshop
- Lesson 1: Getting Started
- Lesson 9: Classes and Objects
- The Concept of Classes and Objects
- The Keywords public and private
- Constructors
- Destructor
- The Copy Constructor
- Different Uses of Constructors and the Destructor
- The this Pointer
- Using sizeof() with a Class
- The Keyword struct and Its Differences from class
- Declaring a friend of a class
- Union: A Special Data Storage Mechanism
- Using Aggregate Initialization on Classes and structs
- Summary
- Q&A
- Workshop
- Lesson 10: Implementing Inheritance
- Basics of Inheritance
- Private Inheritance
- Protected Inheritance
- The Problem of Slicing
- Multiple Inheritance
- Avoiding Inheritance Using final
- Summary
- Q&A
- Workshop
- Lesson 11: Polymorphism
- Basics of Polymorphism
- Using Virtual Inheritance to Solve the Diamond Problem
- Using the Specifier override to Indicate the Intention to Override
- Using final to Prevent Function Overriding
- Virtual Copy Constructors?
- Summary
- Q&A
- Workshop
- Lesson 12: Operator Types and Operator Overloading
- What Are Operators in C++?
- Unary Operators
- Binary Operators
- The Function Operator (())
- The Move Constructor and Move Assignment Operator for High-Performance Programming
- User-Defined Literals
- Operators That Cannot Be Overloaded
- Summary
- Q&A
- Workshop
- Lesson 13: Casting Operators
- The Need for Casting
- Why C-Style Casts Are Not Popular with Some C++ Programmers
- The C++ Casting Operators
- Problems with the C++ Casting Operators
- Summary
- Q&A
- Workshop
- Lesson 14: An Introduction to Macros and Templates
- The Preprocessor and the Compiler
- Using the Macro #define to Define Constants
- Using #define to Write Macro Functions
- An Introduction to Templates
- Summary
- Q&A
- Workshop
- Lesson 15: An Introduction to the Standard Template Library
- STL Containers
- STL Iterators
- STL Algorithms
- Interaction Between Containers and Algorithms Using Iterators
- Choosing the Right Container
- STL String Classes
- Summary
- Q&A
- Workshop
- Lesson 16: The STL String Class
- The Need for String Manipulation Classes
- Working with the STL string Class
- Template-Based Implementation of an STL String
- operator ""s in std::string
- Using std::string_view (Amended in C++20)
- Summary
- Q&A
- Workshop
- Lesson 17: STL Dynamic Array Classes
- The Characteristics of std::vector
- Typical Vector Operations
- Understanding the Concepts of Size and Capacity
- The STL deque Class
- Summary
- Q&A
- Workshop
- Lesson 18: STL list and forward_list
- The Characteristics of std::list
- Basic list Operations
- Reversing and Sorting Elements in a List
- Summary
- Q&A
- Workshop
- Lesson 19: STL set and multiset
- An Introduction to STL Set Classes
- Basic STL set and multiset Operations
- Pros and Cons of Using STL set and multiset
- STL Hash Set Implementation: std::unordered_set and std::unordered_multiset
- Summary
- Q&A
- Workshop
- Lesson 20: STL map and multimap
- An Introduction to STL Map Classes
- Basic std::map and std::multimap Operations
- Supplying a Custom Sort Predicate
- STL’s Hash Table–Based Key/Value Container
- Summary
- Q&A
- Workshop
- Lesson 21: Understanding Function Objects
- Function Objects and Predicates
- Typical Applications of Function Objects
- Summary
- Q&A
- Workshop
- Lesson 22: Lambda Expressions
- What Is a Lambda Expression?
- How to Define a Lambda Expression
- A Lambda Expression for a Unary Function
- A Lambda Expression for a Unary Predicate
- A Lambda Expression with State via Capture Lists ([...])
- A Lambda Expression for a Binary Function
- A Lambda Expression for a Binary Predicate
- Summary
- Q&A
- Workshop
- Lesson 23: STL Algorithms
- What Are STL Algorithms?
- Classification of STL Algorithms
- Usage of STL Algorithms
- C++20 Constrained Algorithms
- Summary
- Q&A
- Workshop
- Lesson 24: Adaptive Containers: Stack and Queue
- The Behavioral Characteristics of Stacks and Queues
- Using the STL stack Class
- Using the STL queue Class
- Using the STL Priority Queue
- Summary
- Q&A
- Workshop
- Lesson 25: Working with Bit Flags Using the STL
- The bitset Class
- Using std::bitset and Its Members
- The vector<bool> Class
- Summary
- Q&A
- Workshop
- Lesson 26: Understanding Smart Pointers
- What Are Smart Pointers?
- How Are Smart Pointers Implemented?
- Types of Smart Pointers
- Popular Smart Pointer Libraries
- Summary
- Q&A
- Workshop
- Lesson 27: Using Streams for Input and Output
- The Concept of Streams
- Important C++ Stream Classes and Objects
- Using std::cout for Writing Formatted Data to the Console
- Using std::cin for Input
- Using std::fstream for File Handling
- Using std::stringstream for String Conversions
- Summary
- Q&A
- Workshop
- Lesson 28: Exception Handling
- What Is an Exception?
- What Causes Exceptions?
- Implementing Exception Safety via try and catch
- Throwing Exceptions of a Type by Using throw
- How Exception Handling Works
- Class std::exception
- A Custom Exception Class Derived from std::exception
- Summary
- Q&A
- Workshop
- Lesson 29: C++20 Concepts, Ranges, Views, and Adaptors
- Concepts
- The Ranges Library, Views, and Adaptors
- Summary
- Q&A
- Workshop
- Lesson 30: C++20 Threads
- Multithreading
- Summary
- Q&A
- Workshop
- Lesson 31: C++20 Modules and C++23
- Modules
- Why import Module; Is Superior to the Preprocessor #include<header>
- C++23 Expected Features
- Learning C++ Doesn’t Stop Here!
- Summary
- Q&A
- Workshop
- Appendix A: Working with Numbers: Binary and Hexadecimal
- Appendix B: C++ Keywords
- Appendix C: Writing Great C++ Code
- Appendix D: ASCII Codes
- Appendix E: Answers
UM RAFBÆKUR Á HEIMKAUP.IS
Bókahillan þín er þitt svæði og þar eru bækurnar þínar geymdar. Þú kemst í bókahilluna þína hvar og hvenær sem er í tölvu eða snjalltæki. Einfalt og þægilegt!Rafbók til eignar
Rafbók til eignar þarf að hlaða niður á þau tæki sem þú vilt nota innan eins árs frá því bókin er keypt.
Þú kemst í bækurnar hvar sem er
Þú getur nálgast allar raf(skóla)bækurnar þínar á einu augabragði, hvar og hvenær sem er í bókahillunni þinni. Engin taska, enginn kyndill og ekkert vesen (hvað þá yfirvigt).
Auðvelt að fletta og leita
Þú getur flakkað milli síðna og kafla eins og þér hentar best og farið beint í ákveðna kafla úr efnisyfirlitinu. Í leitinni finnur þú orð, kafla eða síður í einum smelli.
Glósur og yfirstrikanir
Þú getur auðkennt textabrot með mismunandi litum og skrifað glósur að vild í rafbókina. Þú getur jafnvel séð glósur og yfirstrikanir hjá bekkjarsystkinum og kennara ef þeir leyfa það. Allt á einum stað.
Hvað viltu sjá? / Þú ræður hvernig síðan lítur út
Þú lagar síðuna að þínum þörfum. Stækkaðu eða minnkaðu myndir og texta með multi-level zoom til að sjá síðuna eins og þér hentar best í þínu námi.
Fleiri góðir kostir
- Þú getur prentað síður úr bókinni (innan þeirra marka sem útgefandinn setur)
- Möguleiki á tengingu við annað stafrænt og gagnvirkt efni, svo sem myndbönd eða spurningar úr efninu
- Auðvelt að afrita og líma efni/texta fyrir t.d. heimaverkefni eða ritgerðir
- Styður tækni sem hjálpar nemendum með sjón- eða heyrnarskerðingu
- Gerð : 208
- Höfundur : 18997
- Útgáfuár : 2022
- Leyfi : 380