Part I The Basics
Chapter 2 Hello, World! 43
(
>>18763) 2.2 The classic first program 45
(
>>18765) 2.3 Compilation 47
Chapter 3 Objects, Types, and Values 59
(
>>18766) 3.1 Input 60
(
>>18798) 3.2 Variables 62
(
>>18805) 3.3 Input and type 64
(
>>18813) 3.4 Operations and operators 66
(
>>18854) 3.5 Assignment and initialization 69
(
>>18856) 3.5.1 An example: detect repeated words 71
(
>>18857) 3.6 Composite assignment operators 73
(
>>18858) 3.6.1 An example: find repeated words 73
(
>>18859) 3.7 Names 74
(
>>18910) 3.8 Types and objects 77
(
>>18911) 3.9 Type safety 78
(
>>18913) 3.9.1 Safe conversions 79
(
>>18915) 3.9.2 Unsafe conversions 80
Chapter 4 Computation 89
(
>>18920) 4.3 Expressions 94
(
>>18922) 4.3.1 Constant expressions 95
(
>>18969) 4.3.2 Operators 97
(
>>18970) 4.3.3 Conversions 99
(
>>18994) 4.4 Statements 100
(
>>19044) 4.4.1.1 if-statements 102
(
>>19209) 4.4.1.2 switch-statements 105
(
>>19213) 4.4.1.3 Switch technicalities 106
(
>>19354) 4.4.2.1 while-statements 109
(
>>19394) 4.4.2.2 Blocks 111
(
>>19395) 4.4.2.3 for-statements 111
(
>>19480) 4.5 Functions 113
(
>>19491) 4.5.1 Why bother with functions? 115
(
>>19492) 4.5.2 Function declarations 117
(
>>19606) 4.6 vector 117
(
>>19617) 4.6.1 Traversing a vector 119
(
>>19619) 4.6.2 Growing a vector 119
(
>>19625) 4.6.3 A numeric example 120
(
>>19628) 4.6.4 A text example 123
Chapter 5 Errors 133
(
>>20392) 5.3.1 Syntax errors 137
(
>>20393) 5.3.2 Type errors 138
(
>>20395) 5.3.3 Non-errors 139
(
>>20447) 5.4 Link-time errors 139
(
>>20448) 5.5 Run-time errors 140
(
>>20502) 5.5.1 The caller deals with errors 142
(
>>20521) 5.5.2 The callee deals with errors 143
(
>>20559) 5.5.3 Error reporting 145
(
>>20588) 5.6.1 Bad arguments 147
(
>>20599) 5.6.2 Range errors 148
(
>>20633) 5.6.3 Bad input 150
(
>>20681) 5.6.4 Narrowing errors 153
(
>>20694) 5.7 Logic errors 154
(
>>20696) 5.9.1 Practical debug advice 159
(
>>20713) 5.10 Pre- and post-conditions 163
(
>>20717) 5.10.1 Post-conditions 165
Chapter 6 Writing a Program 173
(
>>21320) 6.1 A problem 174
(
>>21324) 6.3 Back to the calculator! 178
(
>>21325) 6.3.1 First attempt 179
(
>>21327) 6.3.3 Implementing tokens 183
(
>>21343) 6.3.4 Using tokens 185
(
>>21366) 6.4 Grammars 188
(
>>21429) 6.4.1 A detour: English grammar 193
(
>>21439) 6.4.2 Writing a grammar 194
(
>>21444) 6.5.2.1 Expressions: first try 197
(
>>21615) 6.5.2.2 Expressions: second try 198
(
>>21636) 6.5.2.3 Expressions: third time lucky 199
(
>>21662) 6.5.3 Terms 200
(
>>21665) 6.5.4 Primary expressions 202
(
>>21666) 6.6 Trying the first version 203
(
>>21668) 6.7 Trying the second version 208
(
>>21669) 6.8 Token streams 209
(
>>21670) 6.8.1 Implementing Token_stream 211
(
>>21671) 6.8.2 Reading tokens 212
(
>>21672) 6.8.3 Reading numbers 214
(
>>21673) 6.9 Program structure 215
Chapter 7 Completing a Program 221
(
>>21683) 7.2 Input and output 222
(
>>21684) 7.3 Error handling 224
(
>>21685) 7.4 Negative numbers 229
(
>>21688) 7.5 Remainder: % 230
(
>>21689) 7.6.1 Symbolic constants 232
(
>>21690) 7.6.2 Use of functions 234
(
>>21691) 7.6.3 Code layout 235
(
>>21692) 7.6.4 Commenting 237
(
>>21693) 7.7 Recovering from errors 239
(
>>21695) 7.8.1 Variables and definitions 242
(
>>21696) 7.8.2 Introducing names 247
(
>>21697) 7.8.3 Predefined names 250
Chapter 8 Technicalities: Functions, etc. 255
(
>>21719) 8.2 Declarations and definitions 257
(
>>21721) 8.2.2 Variable and constant declarations 262
(
>>21722) 8.2.3 Default initialization 263
(
>>21723) 8.3 Header files 264
(
>>21725) 8.4 Scope 266
(
>>21728) 8.5.1 Declaring arguments and return type 272
(
>>21729) 8.5.2 Returning a value 274
(
>>21730) 8.5.3 Pass-by-value 275
(
>>21731) 8.5.4 Pass-by-const-reference 276
(
>>21733) 8.5.5 Pass-by-reference 279
(
>>21736) 8.5.6 Pass-by-value vs. pass-by-reference 281
(
>>21737) 8.5.7 Argument checking and conversion 284
(
>>21738) 8.5.8 Function call implementation 285
(
>>21739) 8.5.9 constexpr functions 290
(
>>21740) 8.6 Order of evaluation 291
(
>>21741) 8.6.1 Expression evaluation 292
(
>>21742) 8.6.2 Global initialization 293
(
>>21743) 8.7 Namespaces 294
(
>>21744) 8.7.1 using declarations and using directives 296
Chapter 9 Technicalities: Classes, etc. 303
(
>>21780) 9.2 Classes and members 305
(
>>21781) 9.3 Interface and implementation 306
(
>>21783) 9.4.1 struct and functions 308
(
>>21784) 9.4.2 Member functions and constructors 310
(
>>21786) 9.4.3 Keep details private 312
(
>>21788) 9.4.4 Defining member functions 314
(
>>21790) 9.4.5 Referring to the current object 317
(
>>21791) 9.4.6 Reporting errors 317
(
>>21792) 9.5 Enumerations 318
(
>>21793) 9.5.1 “Plain” enumerations 320
(
>>21794) 9.6 Operator overloading 321
(
>>21795) 9.7.1 Argument types 324
(
>>21797) 9.7.2 Copying 326
(
>>21798) 9.7.3 Default constructors 327
(
>>21801) 9.7.4 const member functions 330
(
>>21802) 9.7.5 Members and “helper functions” 332
(
>>21803) 9.8 The Date class 334
Edited last time by Chobitsu on 04/06/2023 (Thu) 22:54:54.