C++ Programmer's Notebook, 2/e

Jim Keogh, James Edward Keogh, John Shapley Gray

  • 出版商: Prentice Hall
  • 出版日期: 2001-08-16
  • 售價: $1,340
  • 貴賓價: 9.5$1,273
  • 語言: 英文
  • 頁數: 508
  • 裝訂: Paperback
  • ISBN: 0130887013
  • ISBN-13: 9780130887016
  • 相關分類: C++ 程式語言
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

相關主題

商品描述

  • Learn C++ fast! Real code, thoroughly explained-and ready to use!
  • Completely updated with over 200 new examples
  • All the fundamentals: variables, operators, arrays, functions, program control, I/O, files, streams, memory management, sorts, searches, and more
  • Advanced topics: data structures, templates, string classes, and exception handling
  • See the code and put it to work—fast, easy, and hands on

C++ Programmer's Notebook, Second Edition teaches C++ the way you want to learn it: with real code! This quick, visual tutorial presents hundreds of annotated "snapshots" of working code, covering all the C++ concepts and techniques you need—and delivering specific solutions you can use right now!

Practical, comprehensive coverage includes:

  • Variables, operators, expressions, arrays, and C-style strings
  • Structures, functions, and program control
  • Objects, classes, overloading, inheritance, and pointers
  • Virtual and friend functions
  • I/O, files, streams, and memory management
  • Sorts and searches
  • Data structures and templates
  • String classes and exception handling
  • Quality checklists for building robust, high-performance code!

Completely updated with over 200 new examples, C++ Programmer's Notebook, Second Edition is the perfect starting point for new C++ developers-and the perfect reference for experienced C++ developers looking for quick solutions!

Table of Contents

Preface.
1. Working with Variables.

Naming Variables. Using Variables. Boolean Variables. Integer Variables. Character Variables. Escape Sequences. Floating Point Variables. Inside Exponential Notation. Data Type Conversion. Assigning Values to Variables. Constants. Scope. Local Variables versus Global Variables. File and Class Scope. Storage Specifiers. Static. Register. Auto. Storage Specifier Rules.


2. Working with Operators and Expressions.

Expressions. Arithmetic Operators. The +=, -=, *=, /= Operators. The ++, -- Operators. Relational Operators. The == and != Operators. Logical Operators. Bitwise Operators. Bitwise AND. Bitwise OR. Bitwise XOR (exclusive OR). Bitwise NOT. The Shift Left Operator. The Shift Right Operator. ?-The Conditional Operator. An Introduction to Indirection. The Precedence Table. Working with Expressions.


3. Working with Arrays and C-Style Strings.

Arrays and Strings. Assigning Values to an Array. Multidimensional Arrays. Assigning Values to a Multidimensional Array. Allocating Arrays Using the new Operator. Allocating Multidimensional Arrays Using the new Operator. C-Style Strings. Copying One C-Style String to Another Using strcpy( ) and strncpy( ). Reading in a C-Style String Using gets( )and fgets( ). Reading a C-Style String from the Keyboard Using scanf( ). Reading a C-Style String from the Keyboard with the Extraction Operator. Reading a C-Style String from the Keyboard with get( ) and getline( ). Comparing Two C-Style Strings. Displaying a C-Style String with printf( ). Displaying a C-Style String with puts( ). Displaying a String with the Insertion Operator. Concatenating C-Style Strings with strcat( ) and strncat( ). Determining the Length of a C-Style String with strlen( ). Determining the Length of a Substring with strcspn( ). Determining the Length of a Substring with strspn( ). Locating a Character within a C-Style String Using strpbrk( ). Locating the First Occurrence of a Substring in a C-Style String with strstr( ). Dividing a C-Style String into Several Substrings Using strtok( ). C-Style Strings versus the String Types of the C++ Standard Library.


4. Working with Structures.

Structures. A Structure at Work. Running the Sample Program. Other Ways to Declare an Instance of a Structure. Assigning Values to Structure Members. Multiple Instances of Structures. Assigning Values to Multiple Instances. Structures within Structures. Passing Members of a Structure to a Function. Passing Members by Address. Passing a Structure to a Function. Passing a Structure to a Function by Reference. Functions Returning Structures. Unions. Enumerations. The typedef Declaration.


5. Working with Functions.

Anatomy of a C++ Program. The main( ) Function. How to Use a Function. Passing Arguments by Value. Passing Multiple Arguments. Passing Arguments Using Reference Variables. Passing Arguments to the main( ) Function. Returning Values. Building a Program Using Functions. Additional Function Facts. Program Statements. White Space Characters. Preprocessor Directives. More Preprocessor Directives. #define with Arguments. inline Function. #if, #else, #elif, #endif. #ifdef, #ifndef, #undef. Using Include Once Header Files. #line, #error, and #pragma.


6. Working with Program Control.

Program Control Statements. The if Statement. The if...else Statement. The ? Operator. Nested if. Multiple Conditions. The switch...case Statement. Tricks of the Trade. for Loop. More on for Loops. while Loop. do...while Loop. break. Continue. exit( ). goto.


7. Working with Objects and Classes.

Classes. Declaring an Instance of a Class. Hiding Data Using the Access Control Specifier. The Constructor. More on Initialization. The Destructor. The Copy Constructor. Defining a Function Member outside the Class Declaration.


8. Working with Overloading.

Overloading. Overloading a Unary Operator. Overloading a Binary Operator. Overloading the Input and Output Operators. Operators that Can and Cannot Be Overloaded.


9. Working with Inheritance.

Inheritance. Access Specifiers. More about Inheritance. Multiple Inheritance. Ambiguity in Multiple Inheritance. Containership Class. Levels of Inheritance.


10. Working with Pointers.

Pointers and References. More on Using Pointers. Incrementing Pointers. Decrementing Pointers. Pointer Math. An Array of Pointers. Pointer-to-a-Pointer. Pointer-to-a-Function. Tricks of the Trade.


11. Working with Virtual and Friend Functions.

Creating a Virtual Function. Virtual Destructors. Creating a Pure Virtual Function. More about Virtual Functions. Friend Functions. Creating a Friend Function from a Function Member Forward Reference of a Class. Friend Classes.


12. Working with Keyboard Input and Screen Output.

C-Style Keyboard Input and Screen Output. Reading a Character from the Keyboard without Echo Using getch( )and _getch( ). Displaying a Character on the Screen with putchar( ). Reading a String from the Keyboard with Less Overhead Using gets( ). Reading Input with Greater Control Using scanf( ). Reading Data with scanf( ). Limiting the Number of Characters Read. Specifying Input String Contents. Creating Your Own Separator. Displaying a String with Less Overhead Using puts( ). Displaying a String with Greater Control Using printf( ). Displaying a String with printf( ). Displaying an Integer with printf( ).


13. Working with Files and Streams.

File Input/Output and Opening and Closing a File. Mode Specifiers for the fopen( ) Function. Writing a Character to a File Using putc( )and fputc( ). Reading a Character from a File Using getc( ). Tricks of the Trade. Writing a String to a File Using fputs( ). Reading a String from a File Using fgets( ). Writing an Integer to a File Using putw( ). Reading an Integer from a File Using getw( ). Writing a Block of Data to a File Using fwrite( ). Reading a Block of Data from a File Using fread( ). Creating a Database File. Reading a Record. Writing Various Data Types to a File or a String Using fprintf( ) and sprintf( ). Reading Various Data Types from a File or a String Using fscanf( ) and sscanf( ). Moving to Specific Locations in a File Using fseek( ). Other File Manipulation Functions. Using a File in C++. Writing Information to a File Using C++. Reading a String from a File Using C++. Reading and Writing a Single Character to a File Using C++. Reading and Writing an Object to a File. Specify the File Mode in C++. Moving to Specific Locations in an Input Using File Using seekg( )and tellg( ). Moving to Specific Locations in an Output File Using seekp( ) and tellp( ). Reading and Writing to the Same File.


14. Working with Memory Management.

Computer Memory. Data in the Program Process Space. Storing Data on the Heap. Storing an Array of Objects on the Heap. Reallocating Heap Memory. Storing Data on the Heap Using the new Operator. Using a Dynamic Array. More on Dynamic Arrays.


15. Working with Sorting and Searching Data.

The Bubble Sort. Inside the Bubble Sort. The Selection Sort. Inside the Selection Sort. The Quick Sort. Inside the Quick Sort. The Sequential (Linear) Search. The Binary Search. A Closer Look at the Binary Search Routine. Using bsearch( ).


16. Working with Data Structures.

Linked Lists. Adding a Node to the End of a Linked List. Adding a Node to Maintain Sorted Order. Removing a Node from a Linked List. Linked List Operators. More on Linked List Operators. Stacks. Implementing a Stack as an Array. Implementing a Stack as a Linked List. Using a Linked List Stack. Queues. Implementing a Queue as an Array. Implementing a Queue as a Linked List. Using a Linked List Queue.


17. Working with Templates.

Templates. Using Template Functions with a Defined Type. Templates with Multiple Parameters. Class Templates. Template Class Friendships.


18. Working with Assertions and Exceptions.

Assertions. try, catch, and throw. More about try, catch, and throw. Functions that Throw Exceptions. Throwing Objects.


Appendix A: A User-Defined String Class.
Appendix B: Keeping Current.
Appendix C: Programmer's Checklist.
Appendix D: ASCII Codes.
Index.

商品描述(中文翻譯)

學習C++快速!真實的程式碼,詳細解釋並準備好使用!
超過200個新範例的完全更新
所有基礎知識:變數、運算符、陣列、函數、程式控制、輸入/輸出、檔案、串流、記憶體管理、排序、搜尋等等
進階主題:資料結構、範本、字串類別和例外處理
查看程式碼並快速上手使用

《C++程式設計師筆記本,第二版》以您想要學習的方式教授C++:使用真實的程式碼!這本快速、視覺化的教學書提供了數百個註解的工作程式碼快照,涵蓋了您需要的所有C++概念和技巧,並提供您可以立即使用的具體解決方案!

實用、全面的內容包括:
變數、運算符、運算式、陣列和C風格字串
結構、函數和程式控制
物件、類別、重載、繼承和指標
虛擬和友元函數
輸入/輸出、檔案、串流和記憶體管理
排序和搜尋
資料結構和範本
字串類別和例外處理
建立堅固、高效能程式碼的品質檢查清單!

《C++程式設計師筆記本,第二版》完全更新,新增了超過200個新範例,是新手C++開發人員的完美起點,也是經驗豐富的C++開發人員尋找快速解決方案的完美參考!

目錄:
前言
1. 使用變數
2. 使用運算符和運算式
3. 使用陣列和C風格字串