Practical C++ Programming. 2nd Edition - Helion
ISBN: 978-14-493-6716-9
stron: 576, Format: ebook
Data wydania: 2002-12-13
Księgarnia: Helion
Cena książki: 152,15 zł (poprzednio: 176,92 zł)
Oszczędzasz: 14% (-24,77 zł)
C++ is a powerful, highly flexible, and adaptable programming language that allows software engineers to organize and process information quickly and effectively. But this high-level language is relatively difficult to master, even if you already know the C programming language.The 2nd edition of Practical C++ Programming is a complete introduction to the C++ language for programmers who are learning C++. Reflecting the latest changes to the C++ standard, this 2nd edition takes a useful down-to-earth approach, placing a strong emphasis on how to design clean, elegant code.In short, to-the-point chapters, all aspects of programming are covered including style, software engineering, programming design, object-oriented design, and debugging. It also covers common mistakes and how to find (and avoid) them. End of chapter exercises help you ensure you've mastered the material.Practical C++ Programming thoroughly covers:
- C++ Syntax
- Coding standards and style
- Creation and use of object classes
- Templates
- Debugging and optimization
- Use of the C++ preprocessor
- File input/output
Osoby które kupowały "Practical C++ Programming. 2nd Edition", wybierały także:
- Windows Media Center. Domowe centrum rozrywki 66,67 zł, (8,00 zł -88%)
- Ruby on Rails. Ćwiczenia 18,75 zł, (3,00 zł -84%)
- Przywództwo w świecie VUCA. Jak być skutecznym liderem w niepewnym środowisku 58,64 zł, (12,90 zł -78%)
- Scrum. O zwinnym zarządzaniu projektami. Wydanie II rozszerzone 58,64 zł, (12,90 zł -78%)
- Od hierarchii do turkusu, czyli jak zarządzać w XXI wieku 58,64 zł, (12,90 zł -78%)
Spis treści
Practical C++ Programming. 2nd Edition eBook -- spis treści
- Practical C++ Programming
- A Note Regarding Supplemental Files
- Preface
- Scope of This Handbook
- How This Book Is Organized
- How to Read This Book If You Already Know C
- Font Conventions
- How to Contact Us
- Acknowledgments for the First Edition
- Acknowledgments for the Second Edition
- I. The Basics
- 1. What Is C++?
- 1.1. A Brief History of C++
- 1.2. C++ Organization
- 1.3. How to Learn C++
- 2. The Basics of Program Writing
- 2.1. Programs from Conception to Execution
- 2.2. Creating a Real Program
- 2.2.1. Creating a Program Using a Command-Line Compiler
- 2.2.1.1. Step 1: Create a place for your program
- 2.2.1.2. Step 2: Create the program
- 2.2.1.3. Step 3: Run the compiler
- 2.2.1.3.1. Unix CC Compiler (Generic Unix)
- 2.2.1.3.2. Free Software Foundations g++ Compiler
- 2.2.1.3.3. Borlands Turbo C++
- 2.2.1.3.4. Microsoft Visual C++ .NET
- 2.2.1.4. Step 4: Execute the program
- 2.2.2. Creating a Program Using an Integrated Development Environment
- 2.2.2.1. Borland C++
- 2.2.2.2. Microsoft Visual C++
- 2.2.1. Creating a Program Using a Command-Line Compiler
- 2.3. Getting Help in Unix
- 2.4. Getting Help in an IDE
- 2.5. Programming Exercises
- 3. Style
- 3.1. Comments
- 3.2. C++ Code
- 3.3. Naming Style
- 3.4. Coding Religion
- 3.5. Indentation and Code Format
- 3.6. Clarity
- 3.7. Simplicity
- 3.8. Consistency and Organization
- 3.9. Further Reading
- 3.10. Summary
- 4. Basic Declarations and Expressions
- 4.1. Basic Program Structure
- 4.2. Simple Expressions
- 4.3. The std::cout Output Object
- 4.4. Variables and Storage
- 4.5. Variable Declarations
- 4.6. Integers
- 4.7. Assignment Statements
- 4.8. Floating-Point Numbers
- 4.9. Floating-Point Divide Versus Integer Divide
- 4.10. Characters
- 4.11. Wide Characters
- 4.12. Boolean Type
- 4.13. Programming Exercises
- 4.14. Answers to Chapter Questions
- 5. Arrays, Qualifiers, and Reading Numbers
- 5.1. Arrays
- 5.2. Strings
- 5.2.1. Wide Strings
- 5.3. Reading Data
- 5.4. Initializing Variables
- 5.4.1. Bounds Errors
- 5.5. Multidimensional Arrays
- 5.6. C-Style Strings
- 5.6.1. Safety and C Strings
- 5.6.2. Reading C-Style Strings
- 5.6.3. Converting Between C-Style and C++ Strings
- 5.6.4. The Differences Between C++ and C-Style Strings
- 5.7. Types of Integers
- 5.7.1. Summary of Integer Types
- 5.8. Types of Floats
- 5.9. Constant and Reference Declarations
- 5.10. Qualifiers
- 5.10.1. Special
- 5.10.2. Constant
- 5.10.3. Storage Class
- 5.10.4. Size
- 5.10.5. Sign
- 5.10.6. Type
- 5.11. Hexadecimal and Octal Constants
- 5.12. Operators for Performing Shortcuts
- 5.13. Side Effects
- 5.14. Programming Exercises
- 5.15. Answers to Chapter Questions
- 6. Decision and Control Statements
- 6.1. if Statement
- 6.2. else Statement
- 6.3. How Not to Use std::strcmp
- 6.4. Looping Statements
- 6.5. while Statement
- 6.6. break Statement
- 6.7. continue Statement
- 6.8. The Assignment Anywhere Side Effect
- 6.9. Programming Exercises
- 6.10. Answers to Chapter Questions
- 7. The Programming Process
- 7.1. Setting Up Your Work Area
- 7.2. The Specification
- 7.3. Code Design
- 7.4. The Prototype
- 7.5. The Makefile
- 7.6. Testing
- 7.7. Debugging
- 7.8. Maintenance
- 7.9. Revisions
- 7.10. Electronic Archaeology
- 7.11. Mark Up the Program
- 7.12. Use the Debugger
- 7.13. Use the Text Editor as a Browser
- 7.14. Add Comments
- 7.15. Programming Exercises
- 1. What Is C++?
- II. Simple Programming
- 8. More Control Statements
- 8.1. for Statement
- 8.2. switch Statement
- 8.3. switch, break, and continue
- 8.4. Programming Exercises
- 8.5. Answers to Chapter Questions
- 9. Variable Scope and Functions
- 9.1. Scope and Storage Class
- 9.1.1. The for Scope
- 9.2. Namespaces
- 9.2.1. Namespace std
- 9.2.2. Global Namespace
- 9.2.3. File-Specific Namespace
- 9.2.4. Nested Namespaces
- 9.2.5. The using Statement
- 9.2.5.1. The problem with the using statement
- 9.3. Functions
- 9.3.1. Returning void
- 9.3.2. Namespaces and Functions
- 9.3.3. const Parameters and Return Values
- 9.3.4. Reference Parameters and Return Values
- 9.3.5. Dangling References
- 9.3.6. Array Parameters
- 9.3.7. Function Overloading
- 9.3.8. Default Arguments
- 9.3.9. Unused Parameters
- 9.3.10. Inline Functions
- 9.4. Summary of Parameter Types
- 9.5. Recursion
- 9.6. Structured Programming Basics
- 9.7. Real-World Programming
- 9.8. Programming Exercises
- 9.9. Answers to Chapter Questions
- 9.1. Scope and Storage Class
- 10. The C++ Preprocessor
- 10.1. #define Statement
- 10.1.1. #define Versus const
- 10.2. Conditional Compilation
- 10.3. #include Files
- 10.4. Parameterized Macros
- 10.4.1. The # Operator
- 10.4.2. Parameterized Macros Versus Inline Functions
- 10.5. Advanced Features
- 10.6. Summary
- 10.7. Programming Exercises
- 10.8. Answers to Chapter Questions
- 10.1. #define Statement
- 11. Bit Operations
- 11.1. Bit Operators
- 11.2. The AND Operator (&)
- 11.3. Bitwise OR (|)
- 11.4. The Bitwise Exclusive OR (^)
- 11.5. The Ones Complement Operator (NOT) (~)
- 11.6. The Left and Right Shift Operators (<<, >>)
- 11.6.1. Right Shift Details
- 11.7. Setting, Clearing, and Testing Bits
- 11.8. Bitmapped Graphics
- 11.9. Programming Exercises
- 11.10. Answers to Chapter Questions
- 8. More Control Statements
- III. Advanced Types and Classes
- 12. Advanced Types
- 12.1. Structures
- 12.2. Unions
- 12.3. typedef
- 12.4. enum Type
- 12.5. Bit Members or Packed Structures
- 12.6. Arrays of Structures
- 12.7. Programming Exercises
- 12.8. Answers to Chapter Questions
- 13. Simple Classes
- 13.1. Stacks
- 13.1.1. Designing a Stack
- 13.2. Improved Stack
- 13.3. Using a Class
- 13.4. Introduction to Constructors and Destructors
- 13.4.1. Destructors
- 13.4.2. Parameterized Constructors
- 13.4.3. Parameterized Destructors
- 13.4.4. Copy Constructor
- 13.5. Automatically Generated Member Functions
- 13.5.1. Automatically Generated and Used Functions
- 13.5.2. Explicit Constructors
- 13.6. Shortcuts
- 13.7. Style
- 13.8. Structures Versus Classes
- 13.9. Programming Exercises
- 13.1. Stacks
- 14. More on Classes
- 14.1. Friends
- 14.1.1. Friend Functions
- 14.1.2. Friend Classes
- 14.2. Constant Functions
- 14.3. Constant Members
- 14.4. Static Member Variables
- 14.5. Static Member Functions
- 14.6. The Meaning of static
- 14.7. Programming Exercises
- 14.1. Friends
- 15. Simple Pointers
- 15.1. const Pointers
- 15.2. Pointers and Printing
- 15.3. Pointers and Arrays
- 15.3.1. Splitting a C-Style String
- 15.4. The reinterpret_cast
- 15.5. Pointers and Structures
- 15.6. Command-Line Arguments
- 15.7. Programming Exercises
- 15.8. Answers to Chapter Questions
- 12. Advanced Types
- IV. Advanced Programming Concepts
- 16. File Input/Output
- 16.1. C++ File I/O
- 16.1.1. Reading C-Style Strings
- 16.1.2. Output Files
- 16.2. Conversion Routines
- 16.3. Binary and ASCII Files
- 16.4. The End-of-Line Puzzle
- 16.5. Binary I/O
- 16.6. Buffering Problems
- 16.7. Unbuffered I/O
- 16.8. Designing File Formats
- 16.9. C-Style I/O Routines
- 16.10. C-Style Conversion Routines
- 16.10.1. The std::printf Family of Output Functions
- 16.10.2. The std::scanf Family of Input Functions
- 16.11. C-Style Binary I/O
- 16.12. C- Versus C++- Style I/O
- 16.12.1. Simplicity
- 16.12.2. Reliability
- 16.12.3. Speed
- 16.12.4. Which Should You Use?
- 16.13. Programming Exercises
- 16.14. Answers to Chapter Questions
- 16.1. C++ File I/O
- 17. Debugging and Optimization
- 17.1. Code Reviews
- 17.1.1. Planning the Review
- 17.1.2. The Review Meeting
- 17.1.3. Why People Dont Do Code Reviews
- 17.1.4. Metrics
- 17.2. Serial Debugging
- 17.2.1. Divide and Conquer
- 17.2.2. The Confessional Method of Debugging
- 17.2.3. Debug-Only Code
- 17.2.4. Debug Command-Line Switch
- 17.3. Going Through the Output
- 17.4. Interactive Debuggers
- 17.4.1. Basic Debugging Commands
- 17.4.2. Debugging a Simple Program
- 17.5. Debugging a Binary Search
- 17.5.1. The First Bug, a Segmentation Fault
- 17.5.2. The Unintended Infinite Loop
- 17.6. Interactive Debugging Tips and Tricks
- 17.7. Runtime Errors
- 17.8. Optimization
- 17.8.1. Profiling
- 17.8.2. Analyzing and Optimizing code
- 17.8.3. Register Declarations
- 17.8.3.1. Loop ordering
- 17.8.3.2. The power of powers of 2
- 17.8.3.3. Making use of pointers
- 17.8.4. Using the System Library
- 17.9. How to Optimize
- 17.10. Case Study: Inline Functions Versus Normal Functions
- 17.11. Case Study: Optimizing a Color-Rendering Algorithm
- 17.12. Programming Exercises
- 17.13. Answers to Chapter Questions
- 17.1. Code Reviews
- 18. Operator Overloading
- 18.1. Creating a Simple Fixed-Point Class
- 18.1.1. Fixed Point Basics
- 18.1.2. Creating the fixed_pt Class
- 18.2. Operator Functions
- 18.2.1. Binary Arithmetic Operators
- 18.2.2. Relational Operators
- 18.2.3. Unary Operators
- 18.2.4. Shortcut Operators
- 18.2.5. Increment and Decrement Operators
- 18.2.6. Logical Operators
- 18.2.7. I/O Operators
- 18.2.8. Index Operator [ ]
- 18.2.9. new and delete
- 18.2.10. Exotic Operators
- 18.3. Operator Member Functions
- 18.3.1. Casting
- 18.4. Warts
- 18.5. Full Definition of the Fixed-Point Class
- 18.6. Programming Exercises
- 18.7. Answers to Chapter Questions
- 18.1. Creating a Simple Fixed-Point Class
- 19. Floating Point
- 19.1. Floating-Point Format
- 19.2. Floating Addition/Subtraction
- 19.3. Multiplication and Division
- 19.4. Overflow and Underflow
- 19.5. Roundoff Error
- 19.6. Accuracy
- 19.7. Minimizing Roundoff Error
- 19.8. Determining Accuracy
- 19.9. Precision and Speed
- 19.10. Power Series
- 19.11. Programming Exercises
- 20. Advanced Pointers
- 20.1. Pointers, Structures, and Classes
- 20.2. delete Operator
- 20.3. Linked Lists
- 20.4. Ordered Linked Lists
- 20.5. Doubly Linked Lists
- 20.6. Trees
- 20.7. Printing a Tree
- 20.8. The Rest of the Program
- 20.9. Data Structures for a Chess Program
- 20.10. Programming Exercises
- 20.11. Answers to Chapter Questions
- 21. Advanced Classes
- 21.1. Derived Classes
- 21.2. Virtual Functions
- 21.3. Virtual Classes
- 21.4. Function Hiding in Derived Classes
- 21.5. Constructors and Destructors in Derived Classes
- 21.6. The dynamic_cast Operator
- 21.7. Summary
- 21.8. Programming Exercises
- 21.9. Answers to Chapter Questions
- 16. File Input/Output
- V. Other Language Features
- 22. Exceptions
- 22.1. Adding Exceptions to the Stack Class
- 22.1.1. Creating an Exception
- 22.1.2. Using a Try Block for Normal Execution
- 22.1.3. Throwing an Exception
- 22.1.4. Exceptions and Destructors
- 22.2. Exceptions Versus assert
- 22.3. Programming Exercises
- 22.1. Adding Exceptions to the Stack Class
- 23. Modular Programming
- 23.1. Modules
- 23.2. Public and Private
- 23.3. The extern Storage Class
- 23.4. Headers
- 23.5. The Body of the Module
- 23.6. A Program to Use Infinite Arrays
- 23.7. The Makefile for Multiple Files
- 23.8. Using the Infinite Array
- 23.9. Dividing a Task into Modules
- 23.10. Module Design Guidelines
- 23.11. Programming Exercises
- 24. Templates
- 24.1. What Is a Template?
- 24.2. Templates: The Hard Way
- 24.3. Templates: The C++ Way
- 24.4. Function Specialization
- 24.5. Class Templates
- 24.6. Class Specialization
- 24.7. Implementation Details
- 24.7.1. Real-World Templates
- 24.7.2. When to Generate Code
- 24.7.3. Writing Portable Templates
- 24.8. Advanced Features
- 24.8.1. Default Parameters
- 24.8.2. Partial Specialization
- 24.9. Summary
- 24.10. Programming Exercises
- 25. Standard Template Library
- 25.1. STL Basics
- 25.1.1. Containers
- 25.1.2. Iterators
- 25.1.3. Algorithms
- 25.2. Class ListA Set of Students
- 25.2.1. Iterating Through a Set
- 25.2.2. Using std::foreach to Write Out the Set
- 25.2.3. Multisets
- 25.3. Creating a Waiting List with the STL List
- 25.4. Storing Grades in a STL Map
- 25.5. Putting It All Together
- 25.6. Practical Considerations When Using the STL
- 25.6.1. Getting the Types Right
- 25.6.2. Error Messages
- 25.7. Getting More Information
- 25.8. Exercises
- 25.1. STL Basics
- 26. Program Design
- 26.1. Design Goals
- 26.2. Design Factors
- 26.3. Design Principles
- 26.4. Coding
- 26.4.1. Procedure Design
- 26.4.1.1. Procedure interface
- 26.4.1.2. Global variables
- 26.4.1.3. Information hiding
- 26.4.1.4. Coding details
- 26.4.2. Modules and Structured Programming
- 26.4.2.1. Interconnections
- 26.4.3. Real-Life Module Organization
- 26.4.4. Module Summary
- 26.4.1. Procedure Design
- 26.5. Objects
- 26.5.1. Interfaces and C++ Classes
- 26.6. Real-World Design Techniques
- 26.6.1. The Linked List Problem
- 26.6.2. Callbacks
- 26.6.3. Decoupling the Interface and Implementation
- 26.7. Conclusion
- 27. Putting It All Together
- 27.1. Requirements
- 27.2. Code Design
- 27.2.1. Token Module
- 27.2.2. Character-Type Module
- 27.2.3. Statistics Class
- 27.3. Coding
- 27.4. Functional Description
- 27.4.1. char_type Class
- 27.4.2. input_file Class
- 27.4.3. token Class
- 27.4.4. stat Class
- 27.4.5. line_counter Class
- 27.4.6. brace_counter Class
- 27.4.7. paren_counter Class
- 27.4.8. comment_counter Class
- 27.4.9. do_file Procedure
- 27.5. Testing
- 27.6. Revisions
- 27.7. A Final Warning
- 27.8. Program Files
- 27.9. Programming Exercises
- 28. From C to C++
- 28.1. K&R-Style Functions
- 28.1.1. Prototypes
- 28.2. struct
- 28.3. malloc and free
- 28.3.1. The C malloc function
- 28.3.2. The C free function
- 28.4. Turning Structures into Classes
- 28.5. setjmp and longjmp
- 28.6. Mixing C and C++ Code
- 28.7. Summary
- 28.8. Programming Exercise
- 28.1. K&R-Style Functions
- 29. C++s Dustier Corners
- 29.1. do/while
- 29.2. goto
- 29.3. The ?: Construct
- 29.4. The Comma Operator
- 29.5. Overloading the ( ) Operator
- 29.6. Pointers to Members
- 29.7. The asm Statement
- 29.8. The mutable Qualifier
- 29.9. Run Time Type Identification
- 29.10. Trigraphs
- 29.11. Answers to Chapter Questions
- 30. Programming Adages
- 30.1. General
- 30.2. Design
- 30.3. Declarations
- 30.4. switch Statement
- 30.5. Preprocessor
- 30.6. Style
- 30.7. Compiling
- 30.8. The Ten Commandments for C++ Programmers
- 30.9. Final Note
- 30.10. Answers to Chapter Questions
- 22. Exceptions
- VI. Appendixes
- A. ASCII Table
- B. Ranges
- C. Operator Precedence Rules
- C.1. Standard Rules
- C.2. Practical Subset of the Operator Precedence Rules
- D. Computing Sine Using a Power Series
- E. Resources
- E.1. Compilers
- E.2. Standard Template Library
- E.3. Standards
- E.4. Programming Tools
- Index
- About the Author
- Colophon
- Copyright