Horton Beginning C++
4th Auflage
ISBN: 978-1-4842-0007-0
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark
E-Book, Englisch, 594 Seiten
Reihe: Professional and Applied Computing
ISBN: 978-1-4842-0007-0
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark
is a tutorial for beginners in C++ and discusses a subset of C++ that is suitable for beginners. The language syntax corresponds to the C++14 standard. This book is environment neutral and does not presume any specific operating system or program development system. There is no assumption of prior programming knowledge.
All language concepts that are explained in the book are illustrated with working program examples. Most chapters include exercises for you to test your knowledge. Code downloads are provided for examples from the text and solutions to the exercises and there is an additional download for a more substantial project for you to try when you have finished the book.
This book introduces the elements of the C++ standard library that provide essential support for the language syntax that is discussed. While the Standard Template Library (STL) is not discussed to a significant extent, a few elements from the STL that are important to the notion of modern C++ are introduced and applied.
is based on and supersedes Ivor Horton’s previous book,
Zielgruppe
Popular/general
Autoren/Hrsg.
Weitere Infos & Material
1;Contents at a Glance;3
2;Contents;603
3;About the Author;619
4;About the Technical Reviewer;620
5;Introduction;5
6;Chapter 1: Basic Ideas;7
6.1;Modern C++;7
6.2;C++ Program Concepts;8
6.2.1;Comments and Whitespace;8
6.2.2;Preprocessing Directives and Header Files;9
6.2.3;Functions;9
6.2.4;Statements;10
6.2.5;Data Input and Output;11
6.2.6;return Statements;11
6.2.7;Namespaces;11
6.2.8;Names and Keywords;12
6.3;Classes and Objects;13
6.4;Templates;13
6.5;Program Files;13
6.6;Standard Libraries;13
6.7;Code Presentation Style;13
6.8;Creating an Executable;14
6.9;Representing Numbers;15
6.9.1;Binary Numbers;15
6.9.2;Hexadecimal Numbers;17
6.9.3;Negative Binary Numbers;18
6.9.4;Octal Values;20
6.9.5;Big-Endian and Little-Endian Systems;20
6.9.6;Floating-Point Numbers;21
6.10;Representing Characters;22
6.10.1;ASCII Codes;22
6.10.2;UCS and Unicode;23
6.11;C++ Source Characters;23
6.11.1;Trigraph Sequences;24
6.11.2;Escape Sequences;24
6.12;Procedural and Object-Oriented Programming;26
6.13;Summary;27
7;Chapter 2: Introducing Fundamental Types of Data;29
7.1;Variables, Data, and Data Types;29
7.1.1;Defining Integer Variables;30
7.1.2;Defining Variables with Fixed Values;32
7.2;Integer Literals;32
7.2.1;Decimal Integer Literals;32
7.2.1.1;Hexadecimal Literals;33
7.2.1.2;Octal Literals;33
7.2.1.3;Binary Literals;34
7.3;Calculations with Integers;34
7.3.1;More on Assignment Operations;36
7.4;The op= Assignment Operators;38
7.5;using Declarations and Directives;40
7.6;The sizeof Operator;40
7.7;Incrementing and Decrementing Integers;41
7.7.1;Postfix Increment and Decrement Operations;41
7.8;Defining Floating-Point Variables;42
7.9;Floating-Point Literals;43
7.10;Floating-Point Calculations;44
7.10.1;Mathematical Functions;46
7.11;Formatting Stream Output;49
7.12;Mixed Expressions and Type Conversion;51
7.13;Explicit Type Conversion;53
7.13.1;Old-Style Casts;55
7.14;Finding the Limits;55
7.15;Working with Character Variables;56
7.15.1;Working with Unicode Characters;57
7.16;The auto Keyword;58
7.17;Lvalues and Rvalues;58
7.18;Summary;59
8;Chapter 3: Working with Fundamental Data Types;61
8.1;Operator Precedence and Associativity;61
8.2;Bitwise Operators;63
8.2.1;The Bitwise Shift Operators;64
8.2.1.1;Shifting Signed Integers;66
8.2.1.2;Logical Operations on Bit Patterns;66
8.2.2;Using the Bitwise AND;67
8.2.3;Using the Bitwise OR;68
8.2.4;Using the Bitwise Exclusive OR;69
8.3;Enumerated Data Types;73
8.3.1;Old-Style Enumerations;76
8.4;Synonyms for Data Types;76
8.5;The Lifetime of a Variable;77
8.6;Positioning Variable Definitions;77
8.6.1;Global Variables;77
8.6.2;Static Variables;81
8.7;External Variables;81
8.8;Summary;82
9;Chapter 4: Making Decisions;84
9.1;Comparing Data Values;84
9.1.1;Applying the Comparison Operators;85
9.1.2;Comparing Floating Point Values;87
9.2;The if Statement;87
9.2.1;Nested if Statements;90
9.2.2;Code-Neutral Character Handling;91
9.3;The if-else Statement;93
9.3.1;Nested if-else Statements;94
9.3.2;Understanding Nested ifs;95
9.4;Logical Operators;97
9.4.1;Logical AND;97
9.4.2;Logical OR;98
9.4.3;Logical Negation;98
9.5;The Conditional Operator;100
9.6;The switch Statement;102
9.7;Unconditional Branching;105
9.8;Statement Blocks and Variable Scope;106
9.9;Summary;107
10;Chapter 5: Arrays and Loops;109
10.1;Arrays;109
10.1.1;Using an Array;110
10.2;Understanding Loops;111
10.3;The for Loop;112
10.4;Avoiding Magic Numbers;114
10.5;Defining the Array Size with the Initializer List;115
10.6;Determining the Size of an Array;115
10.7;Controlling a for Loop with Floating-Point Values;117
10.8;More Complex for Loop Control Expressions;118
10.9;The Comma Operator;120
10.10;The Ranged-based for Loop;120
10.11;The while Loop;121
10.12;Allocating an Array at Runtime;123
10.13;The do-while Loop;125
10.14;Nested Loops;127
10.15;Skipping Loop Iterations;129
10.16;Breaking Out of a Loop;131
10.16.1;Indefinite Loops;131
10.17;Arrays of Characters;135
10.18;Multidimensional Arrays;138
10.18.1;Initializing Multidimensional Arrays;140
10.18.1.1;Setting Dimensions by Default;141
10.18.2;Multidimensional Character Arrays;142
10.19;Alternatives to Using an Array;144
10.19.1;Using array