The Zen of C++
Author(s): Adnan Zejnilovic
Edition: 2
Copyright: 2017
The Zen of C++ provides a practical introduction to C++ programming, guiding readers from fundamental programming concepts to more advanced topics in software development. The book covers data types, input and output, expressions, control structures, loops, file handling, functions, arrays, vectors, pointers, string manipulation, structures, and abstract data types while emphasizing programming style, problem-solving techniques, and best practices. End-of-chapter questions and a comprehensive answer key reinforce learning and help readers build a foundation in C++ programming.
Acknowledgements
Chapter 1: Fundamental Data Types
C++ Programming Process
Your 1st C++ Program
Programming Style
Fundamental Data Types
Variable Assignments, Initializations, Scope
End of Chapter Questions
Chapter 2: Interactive Input, Expressions, and Formatting
Interacting with the User
Mathematical Library Functions
Type Conversion
Type Casting
Expressions
Operators
Conditional Statements
Formatting Output
End of Chapter Questions
Chapter 3: Loops
While Loop
Do While Loop
For Loop
Nested Loops
End of Chapter Questions
Chapter 4: Streams—Input, Output, and Customization
The Basics
How to Read/Write from/to Files Programmatically
Miscellaneous File Functions
End of Chapter Questions
Chapter 5: Functions
What Is a Function?
Benefits of Using Functions
Function Calls
Function Definition
Function Prototypes
Passing by Value
Functions with Multiple Parameters
Pass by Reference
Value Returning Functions
void Functions and the return Statement
Default Arguments
Overloading Functions
Scope
Global Variables and Global Constants
Local Variables
Static Local Variables
The exit(0) Function
Stubs and Drivers
End of Chapter Questions
Chapter 6: Arrays and Vectors
What Is an Array?
Declaring an Array
Array Initialization
Bounds Checking
Array Operations
Arrays and Functions
Vectors
End of Chapter Questions
Chapter 7: Pointers
Intro to Pointers
Pointer Variables
Dereferencing Pointers
Pointers and Arrays
Pointer Arithmetic
Comparing Pointers
Pointers and Functions
Constant Pointers and Pointers to Constants
Dynamic Memory Allocation
Returning Pointers from Functions
End of Chapter Questions
Chapter 8: Handling Text
Character Testing
C-Style Strings
Correctly Dimensioning Character Arrays
Conversion Functions
C++ string Class
Assigning Strings
Concatenating Strings
String Comparisons
Capacity Member Functions
Accessing Elements
Searching for a Substring
Modifying a String
Working with Legacy Code
Conclusion
End of Chapter Questions
Chapter 9: Abstract Data Types
Primitive Data Types vs. Abstract Data Types
Structures
Initialization
Initialization List Initialization
Member Access
Math Operations on Structure Members
Arrays as Structure Members
Nested Structures
Arrays of Structures
Initializing an Array of Structures through an Initialization List
Passing Structures to Functions
Returning Structures from Functions
Design Strategies
Pointers to Structures
Pointers to Structures as Function Parameters
Returning Structure Pointers from Functions
Deleting Dynamically Allocated Memory
Enumerated Data Types
End of Chapter Questions
Chapter 10: Answer Key
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Adnan Zejnilovic is a senior associate professor in the Technology department at Miami Dade College.
The Zen of C++ provides a practical introduction to C++ programming, guiding readers from fundamental programming concepts to more advanced topics in software development. The book covers data types, input and output, expressions, control structures, loops, file handling, functions, arrays, vectors, pointers, string manipulation, structures, and abstract data types while emphasizing programming style, problem-solving techniques, and best practices. End-of-chapter questions and a comprehensive answer key reinforce learning and help readers build a foundation in C++ programming.
Acknowledgements
Chapter 1: Fundamental Data Types
C++ Programming Process
Your 1st C++ Program
Programming Style
Fundamental Data Types
Variable Assignments, Initializations, Scope
End of Chapter Questions
Chapter 2: Interactive Input, Expressions, and Formatting
Interacting with the User
Mathematical Library Functions
Type Conversion
Type Casting
Expressions
Operators
Conditional Statements
Formatting Output
End of Chapter Questions
Chapter 3: Loops
While Loop
Do While Loop
For Loop
Nested Loops
End of Chapter Questions
Chapter 4: Streams—Input, Output, and Customization
The Basics
How to Read/Write from/to Files Programmatically
Miscellaneous File Functions
End of Chapter Questions
Chapter 5: Functions
What Is a Function?
Benefits of Using Functions
Function Calls
Function Definition
Function Prototypes
Passing by Value
Functions with Multiple Parameters
Pass by Reference
Value Returning Functions
void Functions and the return Statement
Default Arguments
Overloading Functions
Scope
Global Variables and Global Constants
Local Variables
Static Local Variables
The exit(0) Function
Stubs and Drivers
End of Chapter Questions
Chapter 6: Arrays and Vectors
What Is an Array?
Declaring an Array
Array Initialization
Bounds Checking
Array Operations
Arrays and Functions
Vectors
End of Chapter Questions
Chapter 7: Pointers
Intro to Pointers
Pointer Variables
Dereferencing Pointers
Pointers and Arrays
Pointer Arithmetic
Comparing Pointers
Pointers and Functions
Constant Pointers and Pointers to Constants
Dynamic Memory Allocation
Returning Pointers from Functions
End of Chapter Questions
Chapter 8: Handling Text
Character Testing
C-Style Strings
Correctly Dimensioning Character Arrays
Conversion Functions
C++ string Class
Assigning Strings
Concatenating Strings
String Comparisons
Capacity Member Functions
Accessing Elements
Searching for a Substring
Modifying a String
Working with Legacy Code
Conclusion
End of Chapter Questions
Chapter 9: Abstract Data Types
Primitive Data Types vs. Abstract Data Types
Structures
Initialization
Initialization List Initialization
Member Access
Math Operations on Structure Members
Arrays as Structure Members
Nested Structures
Arrays of Structures
Initializing an Array of Structures through an Initialization List
Passing Structures to Functions
Returning Structures from Functions
Design Strategies
Pointers to Structures
Pointers to Structures as Function Parameters
Returning Structure Pointers from Functions
Deleting Dynamically Allocated Memory
Enumerated Data Types
End of Chapter Questions
Chapter 10: Answer Key
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9