LearnCpp.com 是一個(gè)免費(fèi)網(wǎng)站,致力于教您如何使用 C++ 進(jìn)行編程。無(wú)論您以前是否有任何編程經(jīng)驗(yàn),本站點(diǎn)上的教程都將引導(dǎo)您完成編寫(xiě)、編譯和調(diào)試 C++ 程序的所有步驟,所有步驟均帶有大量示例。
成為專家不會(huì)在一夜之間發(fā)生,但只要有一點(diǎn)耐心,您就會(huì)到達(dá)那里。LearnCpp.com 將為您指明方向。
第0章
簡(jiǎn)介/入門
0.1
這些教程的介紹
0.2
編程語(yǔ)言簡(jiǎn)介
0.3
C/C++簡(jiǎn)介
0.4
C++開(kāi)發(fā)簡(jiǎn)介
0.5
編譯器、鏈接器和庫(kù)簡(jiǎn)介
0.6
安裝集成開(kāi)發(fā)環(huán)境 (IDE)
0.7
編譯你的第一個(gè)程序
0.8
幾個(gè)常見(jiàn)的C++問(wèn)題
0.9
配置編譯器:構(gòu)建配置
0.10
配置編譯器:編譯器擴(kuò)展
0.11
配置編譯器:警告和錯(cuò)誤級(jí)別
0.12
配置編譯器:選擇語(yǔ)言標(biāo)準(zhǔn)
第1章
C++ 基礎(chǔ)知識(shí)
1.1
語(yǔ)句和程序結(jié)構(gòu)
1.2
評(píng)論
1.3
對(duì)象和變量簡(jiǎn)介
1.4
變量賦值和初始化
1.5
iostream 簡(jiǎn)介:cout、cin 和 endl
1.6
未初始化的變量和未定義的行為
1.7
關(guān)鍵字和命名標(biāo)識(shí)符
1.8
空格和基本格式
1.9
字面量和運(yùn)算符簡(jiǎn)介
1.10
表達(dá)式介紹
1.11
開(kāi)發(fā)你的第一個(gè)程序
1.x
第一章小結(jié)與小測(cè)驗(yàn)
第2章
C++ 基礎(chǔ):函數(shù)和文件
2.1
功能介紹
2.2
函數(shù)返回值(value-returning functions)
2.3
Void functions(無(wú)值返回函數(shù))
2.4
函數(shù)參數(shù)和參數(shù)介紹
2.5
局部作用域介紹
2.6
為什么函數(shù)有用,以及如何有效地使用它們
2.7
轉(zhuǎn)發(fā)聲明和定義
2.8
具有多個(gè)代碼文件的程序
2.9
命名沖突和命名空間簡(jiǎn)介
2.10
預(yù)處理器簡(jiǎn)介
2.11
頭文件
2.12
頭部護(hù)板
2.13
如何設(shè)計(jì)你的第一個(gè)程序
2.x
第二章小結(jié)與小測(cè)驗(yàn)
第3章
調(diào)試 C++ 程序
3.1
語(yǔ)法和語(yǔ)義錯(cuò)誤
3.2
調(diào)試過(guò)程
3.3
調(diào)試策略
3.4
基本調(diào)試策略
3.5
更多調(diào)試策略
3.6
使用集成調(diào)試器:步進(jìn)
3.7
使用集成調(diào)試器:運(yùn)行和斷點(diǎn)
3.8
使用集成調(diào)試器:觀察變量
3.9
使用集成調(diào)試器:調(diào)用堆棧
3.10
在問(wèn)題成為問(wèn)題之前發(fā)現(xiàn)問(wèn)題
3.x
第三章小結(jié)與小測(cè)驗(yàn)
第 4 章
基本數(shù)據(jù)類型
4.1
基本數(shù)據(jù)類型介紹
4.2
空白
4.3
對(duì)象大小和 sizeof 運(yùn)算符
4.4
有符號(hào)整數(shù)
4.5
無(wú)符號(hào)整數(shù),以及為什么要避免它們
4.6
固定寬度整數(shù)和 size_t
4.7
科學(xué)計(jì)數(shù)法簡(jiǎn)介
4.8
浮點(diǎn)數(shù)字
4.9
布爾值
4.10
if語(yǔ)句簡(jiǎn)介
4.11
字符
4.12
類型轉(zhuǎn)換和static_cast簡(jiǎn)介
4.13
Const 變量和符號(hào)常量
4.14
編譯時(shí)常量、常量表達(dá)式和 constexpr
4.15
文字
4.16
數(shù)字系統(tǒng)(十進(jìn)制、二進(jìn)制、十六進(jìn)制和八進(jìn)制)
4.17
std::string 簡(jiǎn)介
4.18
std::string_view 簡(jiǎn)介
4.x
第四章小結(jié)與測(cè)驗(yàn)
第 5 章
運(yùn)營(yíng)商
5.1
運(yùn)算符優(yōu)先級(jí)和結(jié)合性
5.2
算術(shù)運(yùn)算符
5.3
模數(shù)和指數(shù)
5.4
遞增/遞減運(yùn)算符和副作用
5.5
逗號(hào)和條件運(yùn)算符
5.6
關(guān)系運(yùn)算符和浮點(diǎn)數(shù)比較
5.7
邏輯運(yùn)算符
5.x
第五章小結(jié)與測(cè)驗(yàn)
O章
位操作(可選章節(jié))
O.1
通過(guò) std::bitset 進(jìn)行位標(biāo)志和位操作
O.2
按位運(yùn)算符
O.3
使用按位運(yùn)算符和位掩碼進(jìn)行位操作
O.4
二進(jìn)制和十進(jìn)制之間的轉(zhuǎn)換
第6章
范圍、持續(xù)時(shí)間和聯(lián)系
6.1
復(fù)合語(yǔ)句(塊)
6.2
用戶定義的命名空間和范圍解析運(yùn)算符
6.3
局部變量
6.4
全局變量介紹
6.5
變量陰影(名稱隱藏)
6.6
內(nèi)部聯(lián)動(dòng)
6.7
外部鏈接和變量前向聲明
6.8
為什么(非常量)全局變量是邪惡的
6.9
跨多個(gè)文件共享全局常量(使用內(nèi)聯(lián)變量)
6.10
靜態(tài)局部變量
6.11
范圍、持續(xù)時(shí)間和聯(lián)系摘要
6.12
使用聲明和使用指令
6.13
內(nèi)聯(lián)函數(shù)
6.14
Constexpr 和 consteval 函數(shù)
6.15
未命名和內(nèi)聯(lián)命名空間
6.x
第6章小結(jié)與測(cè)驗(yàn)
第7章
控制流和錯(cuò)誤處理
7.1
控制流程介紹
7.2
If 語(yǔ)句和塊
7.3
常見(jiàn)的if語(yǔ)句問(wèn)題
7.4
開(kāi)關(guān)語(yǔ)句基礎(chǔ)
7.5
切換失敗和范圍
7.6
轉(zhuǎn)到語(yǔ)句
7.7
循環(huán)和 while 語(yǔ)句簡(jiǎn)介
7.8
執(zhí)行 while 語(yǔ)句
7.9
對(duì)于語(yǔ)句
7.10
中斷并繼續(xù)
7.11
暫停(提前退出程序)
7.12
代碼測(cè)試簡(jiǎn)介
7.13
代碼覆蓋率
7.14
C++ 中的常見(jiàn)語(yǔ)義錯(cuò)誤
7.15
檢測(cè)和處理錯(cuò)誤
7.16
std::cin 和處理無(wú)效輸入
7.17
斷言和 static_assert
7.18
隨機(jī)數(shù)生成簡(jiǎn)介
7.19
使用 Mersenne Twister 生成隨機(jī)數(shù)
7.x
第7章小結(jié)與測(cè)驗(yàn)
第8章
類型轉(zhuǎn)換和函數(shù)重載
8.1
Implicit type conversion (coercion)
8.2
Floating-point and integral promotion
8.3
Numeric conversions
8.4
Arithmetic conversions
8.5
Explicit type conversion (casting) and static_cast
8.6
Typedefs and type aliases
8.7
Type deduction for objects using the auto keyword
8.8
Type deduction for functions
8.9
Introduction to function overloading
8.10
Function overload differentiation
8.11
Function overload resolution and ambiguous matches
8.12
Default arguments
8.13
Function templates
8.14
Function template instantiation
8.15
Function templates with multiple template types
8.x
Chapter 8 summary and quiz
Chapter 9
Compound Types: References and Pointers
9.1
Introduction to compound data types
9.2
Value categories (lvalues and rvalues)
9.3
Lvalue references
9.4
Lvalue references to const
9.5
Pass by lvalue reference
9.6
Introduction to pointers
9.7
Null pointers
9.8
Pointers and const
9.9
Pass by address
9.10
Pass by address (part 2)
9.11
Return by reference and return by address
9.12
Type deduction with pointers, references, and const
9.x
Chapter 9 summary and quiz
Chapter 10
Compound Types: Enums and Structs
10.1
Introduction to program-defined (user-defined) types
10.2
Unscoped enumerations
10.3
Unscoped enumeration input and output
10.4
Scoped enumerations (enum classes)
10.5
Introduction to structs, members, and member selection
10.6
Struct aggregate initialization
10.7
Default member initialization
10.8
Struct passing and miscellany
10.9
Member selection with pointers and references
10.10
Class templates
10.11
Class template argument deduction (CTAD) and deduction guides
10.x
Chapter 10 summary and quiz
10.y
Using a language reference
Chapter 11
Arrays, Strings, and Dynamic Allocation
11.1
Arrays (Part I)
11.2
Arrays (Part II)
11.3
Arrays and loops
11.4
Sorting an array using selection sort
11.5
Multidimensional Arrays
11.6
C-style strings
11.7
std::string_view (part 2)
11.8
Pointers and arrays
11.9
Pointer arithmetic and array indexing
11.10
C-style string symbolic constants
11.11
Dynamic memory allocation with new and delete
11.12
Dynamically allocating arrays
11.13
For-each loops
11.14
Void pointers
11.15
Pointers to pointers and dynamic multidimensional arrays
11.16
An introduction to std::array
11.17
An introduction to std::vector
11.18
Introduction to iterators
11.19
Introduction to standard library algorithms
11.x
Chapter 11 comprehensive quiz
Chapter 12
Functions
12.1
Function Pointers
12.2
The stack and the heap
12.3
std::vector capacity and stack behavior
12.4
Recursion
12.5
Command line arguments
12.6
Ellipsis (and why to avoid them)
12.7
Introduction to lambdas (anonymous functions)
12.8
Lambda captures
12.x
Chapter 12 comprehensive quiz
Chapter 13
Basic Object-oriented Programming
13.1
Welcome to object-oriented programming
13.2
Classes and class members
13.3
Public vs private access specifiers
13.4
Access functions and encapsulation
13.5
Constructors
13.6
Constructor member initializer lists
13.7
Non-static member initialization
13.8
Overlapping and delegating constructors
13.9
Destructors
13.10
The hidden “this” pointer
13.11
Class code and header files
13.12
Const class objects and member functions
13.13
Static member variables
13.14
Static member functions
13.15
Friend functions and classes
13.16
Anonymous objects
13.17
Nested types in classes
13.18
Timing your code
13.x
Chapter 13 comprehensive quiz
Chapter 14
Operator overloading
14.1
Introduction to operator overloading
14.2
Overloading the arithmetic operators using friend functions
14.3
Overloading operators using normal functions
14.4
Overloading the I/O operators
14.5
Overloading operators using member functions
14.6
Overloading unary operators +, -, and !
14.7
Overloading the comparison operators
14.8
Overloading the increment and decrement operators
14.9
Overloading the subscript operator
14.10
Overloading the parenthesis operator
14.11
Overloading typecasts
14.12
The copy constructor
14.13
Copy initialization
14.14
Converting constructors, explicit, and delete
14.15
Overloading the assignment operator
14.16
Shallow vs. deep copying
14.17
Overloading operators and function templates
14.x
Chapter 14 comprehensive quiz
Chapter 15
Reserved for Future Reorganization
Chapter 16
An Introduction to Object Relationships
16.1
Object relationships
16.2
Composition
16.3
Aggregation
16.4
Association
16.5
Dependencies
16.6
Container classes
16.7
std::initializer_list
16.x
Chapter 16 comprehensive quiz
Chapter 17
Inheritance
17.1
Introduction to inheritance
17.2
Basic inheritance in C++
17.3
Order of construction of derived classes
17.4
Constructors and initialization of derived classes
17.5
Inheritance and access specifiers
17.6
Adding new functionality to a derived class
17.7
Calling inherited functions and overriding behavior
17.8
Hiding inherited functionality
17.9
Multiple inheritance
17.x
Chapter 17 comprehensive quiz
Chapter 18
Virtual Functions
18.1
Pointers and references to the base class of derived objects
18.2
Virtual functions and polymorphism
18.3
The override and final specifiers, and covariant return types
18.4
Virtual destructors, virtual assignment, and overriding virtualization
18.5
Early binding and late binding
18.6
The virtual table
18.7
Pure virtual functions, abstract base classes, and interface classes
18.8
Virtual base classes
18.9
Object slicing
18.10
Dynamic casting
18.11
Printing inherited classes using operator<<
18.x
Chapter 18 comprehensive quiz
Chapter 19
Templates and Classes
19.1
Template classes
19.2
Template non-type parameters
19.3
Function template specialization
19.4
Class template specialization
19.5
Partial template specialization
19.6
Partial template specialization for pointers
19.x
Chapter 19 comprehensive quiz
Chapter 20
Exceptions
20.1
The need for exceptions
20.2
Basic exception handling
20.3
Exceptions, functions, and stack unwinding
20.4
Uncaught exceptions and catch-all handlers
20.5
Exceptions, classes, and inheritance
20.6
Rethrowing exceptions
20.7
Function try blocks
20.8
Exception dangers and downsides
20.9
Exception specifications and noexcept
20.x
Chapter 20 comprehensive quiz
Chapter M
Move Semantics and Smart Pointers
M.1
Introduction to smart pointers and move semantics
M.2
R-value references
M.3
Move constructors and move assignment
M.4
std::move
M.5
std::move_if_noexcept
M.6
std::unique_ptr
M.7
std::shared_ptr
M.8
Circular dependency issues with std::shared_ptr, and std::weak_ptr
M.x
Chapter M comprehensive review
Chapter 21
The Standard Template Library
21.1
The Standard Library
21.2
STL containers overview
21.3
STL iterators overview
21.4
STL algorithms overview
Chapter 22
std::string
22.1
std::string and std::wstring
22.2
std::string construction and destruction
22.3
std::string length and capacity
22.4
std::string character access and conversion to C-style arrays
22.5
std::string assignment and swapping
22.6
std::string appending
22.7
std::string inserting
Chapter 23
Input and Output (I/O)
23.1
Input and output (I/O) streams
23.2
Input with istream
23.3
Output with ostream and ios
23.4
Stream classes for strings
23.5
Stream states and input validation
23.6
Basic file I/O
23.7
隨機(jī)文件 I/O
附錄 A
雜項(xiàng)科目
A.1
靜態(tài)庫(kù)和動(dòng)態(tài)庫(kù)
A2
在 Visual Studio 中使用庫(kù)
A.3
將庫(kù)與 Code::Blocks 一起使用
A.4
C++常見(jiàn)問(wèn)題解答
附錄 B
C++ 更新
B.1
C++11簡(jiǎn)介
B.2
C++14簡(jiǎn)介
B.3
C++17簡(jiǎn)介
B.4
C++20簡(jiǎn)介
附錄 C
結(jié)束
C.1
結(jié)束?
聯(lián)系客服