Preface.
Why a New C++ Book?
What Else Is New about This Book?
Multiple Learning Paths:What Fits You Best.
What If You Already Have a Programming Background?
What Is Not Covered?
Why Should Anyone Start with C++?
To Get Started.
Tips and Tricks: What Do I Watch Out For?
Acknowledgments.
1. Your First C++ Programs.
Thinking like a Programmer.
What's Different about C++?
Building a C++ Program.
Installing Your Own C++ Compiler.
Example 1.1. Print a Message.
Advancing to the Next Print Line.
Example 1.2. Print Multiple Lines.
Storing Data: C++ Variables.
Introduction to Data Types.
Example 1.3. Convert Temperatures.
A Word about Variable Names and Keywords.
Chapter 1 Summary.
2. Decisions, Decisions.
But First, a Few Words about Data Types.
Decision Making in Programs.
If and if-else.
Example 2.1. Odd or Even?
Introducing Loops.
Example 2.2. Print 1 to N.
True and False in C++.
The Increment Operator (++).
Statements vs. Expressions.
Introducing Boolean (Short-Circuit) Logic.
Example 2.3. Testing a Person's Age.
Introducing the Math Library.
Example 2.4. Prime-Number Test.
Chapter 2 Summary.
3. The Handy, All-Purpose "for" Statement.
Loops Used for Counting.
Introducing the "for" Loop.
A Wealth of Examples.
Example 3.1. Printing 1 to N with "for".
Statement Blocks with "for".
Declaring Loop Variables on the Fly.
Example 3.2. Prime-Number Test with "for".
Comparative Languages 101: The Basic "for" Statement.
Chapter 3 Summary.
4. Functions: Many Are Called.
The Concept of Function.
Function Calls and the Flow of the Program.
The Basics of Using Functions.
Example 4.1. Triangle-Number Function.
Example 4.2. Prime-Number Function.
Local and Global Variables.
Recursive Functions.
Example 4.3. Greatest Common Factor (GCF).
Example 4.4. Prime Factorization.
Example 4.5. Random-Number Generator.
Chapter 4 Summary.
5. Arrays: We've Got Their Number.
A First Look at C++ Arrays.
Initializing Arrays.
Zero-Based Indexing.
Example 5.1. Print Out Elements.
Example 5.2.How Random Is Random?
Strings and Arrays of Strings.
Example 5.3. Card Dealer #1.
Example 5.4. Card Dealer #2.
Example 5.5. Card Dealer#3.
A Word to the Wise.
2-D Arrays: Into the Matrix.
Chapter 5 Summary.
6. Pointers: Getting a Handle on Data.
The Concept of Pointer.
Declaring and Using Pointers.
Example 6.1. The Double-It Function.
Swap: Another Function Using Pointers.
Example 6.2.Array Sorter.
Pointer Arithmetic.
Pointers and Array Processing.
Example 6.3. Zero Out an Array.
Chapter 6 Summary.
7. Strings: Analyzing the Text.
Text Storage on the Computer.
It Don't Mean a Thing If It Ain't Got That String.
String-Manipulation Functions.
Example 7.1. Building Strings.
Reading String Input.
Example 7.2. Get a Number.
Example 7.3. Convert to Uppercase.
Individual Characters vs. Strings.
Example 7.4.Analyze Input.
The New C++ String Class.
Example 7.5. Building Strings with the string Type.
Other Operations on the string Type.
Chapter 7 Summary.
8. Files: Electronic Storage.
Introducing File-Stream Objects.
How to Refer to Disk Files.
Example 8.1.Write Text to a File.
Example 8.2. Display a Text File.
Text Files vs. "Binary" Files.
Introducing Binary Operations.
Example 8.3. Random-Access Write.
Example 8.4. Random-Access Read.
Chapter 8 Summary.
9. Some Advanced Programming Techniques.
Command-Line Arguments.
Example 9.1. Display File from Command Line.
Function Overloading.
Example 9.2. Printing Different Types of Arrays.
The do-while Loop.
The switch-case Statement.
Multiple Modules.
Exception Handling.
Example 9.3. Exception Handling with GCF.
Chapter 9 Summary.
10. Getting Yourself Object Oriented.
Why Get Object Oriented?
A String Parser.
Objects vs. Classes.
Another Example: The Fraction Class.
Object Creation and Destruction.
Inheritance, or Subclassing.
Creating Shared Interfaces.
Polymorphism: True Object Independence.
Polymorphism and Virtual Functions.
What about Reusability?
Chapter 10 Summary.
11. The Fraction Class.
Point: A Simple Class.
Private:Members Only (Protecting the Data).
Example 11.1. Testing the Point Class.
Introducing the Fraction Class.
Inline Functions.
Find the Greatest Common Factor.
Find the Lowest Common Multiple.
Example 11.2. Fraction Support Functions.
Example 11.3. Testing the Fraction Class.
Example 11.4. Fraction Arithmetic: add and mult.
Chapter 11 Summary.
12. Constructors: If You Build It….
Introducing Constructors.
Multiple Constructors (Overloading).
The Default Constructor…and a Warning.
Example 12.1. Point Class Constructors.
Example 12.2. Fraction Class Constructors.
Reference Variables and Arguments (&).
The Copy Constructor.
Example 12.3. Fraction Class Copy Constructor.
Chapter 12 Summary.
13. Operator Functions: Doing It with Class.
Introducing Class Operator Functions.
Operator Functions As Global Functions.
Improve Efficiency with References.
Example 13.1. Point Class Operators.
Example 13.2. Fraction Class Operators.
Working with Other Types.
The Class Assignment Function (=).
The Test-for-Equality Function (==).
A Class "Print" Function.
Example 13.3. The Completed Fraction Class.
Chapter 13 Summary.
14. What's "new": The StringParser Class.
The "new"Operator.
Objects and "new".
Allocating Array Data.
Example 14.1. Dynamic Memory in Action.
Design for a Parser (Lexical Analyzer).
Example 14.2. The StringParser Class.
Chapter 14 Summary.
15. What's "this": The String Class.
Introducing the String Class.
Introducing Class Destructors.
Example 15.1. A Simple String Class.
"Deep" Copying and the Copy Constructor.
The "this" Keyword.
Revisiting the Assignment Operator.
Writing a Concatenation Function.
Example 15.2. The Complete String Class.
Chapter 15 Summary.
16. Inheritance: What a Legacy.
Subclassing for Fun and Profit.
Example 16.1. The FloatFraction Class.
Problems with the FloatFraction Class.
Example 16.2. The Completed FloatFraction Class.
Example 16.3. The ProperFraction Class.
Private and Protected Members.
Example 16.4. Contained Members: FractionUnits.
Chapter 16 Summary.
17. Polymorphism: Object Independence.
A Different Approach to the FloatFraction Class.
Virtual Functions to the Rescue!
Example 17.1. The Revised FloatFraction Class.
"Pure Virtual" and Other Arcane Matters.
Abstract Classes and Interfaces.
Why cout Is Not Truly Polymorphic.
Example 17.2. True Polymorphism: The Printable Class.
A Final Word (or Two).
A Final Final Word.
Chapter 17 Summary.
Appendix A. C++ Operators.
Appendix B. Intrinsic Data Types.
Appendix C. C++ Syntax Summary.
Appendix D. ASCII Codes.
Appendix E. Common Library Functions.
Appendix F. Glossary of Terms.
Index.
Introductory programming books for C++ exist aplenty. But many--the greatmajority--are "introductory" only in the sense that they don't assumeknowledge of C++ specifically. They usually assume that you've programmedin another language before--preferably in several. This book does not makethat assumption. All that's required is that you're comfortable with a computerand that you've run applications, such as a word processor or e-mail reader,before.Four or five years ago, when people needed to learn C++, they bought BjarneStroustrup's "The C++ Programming Language" or Stan Lippman's "C++Primer." What we have seen in the last few years is a "dummying" of themarket. Books that were once purchased as someone's first book on C++, sayfor example, "C++ for Dummies," are now too high level and assume someprogramming knowledge. With this new book, we are the first to meet newmarket needs for a true beginner's C++ book--one that is perfect for beginningprogrammers in today's world who may not know any programming languagesat all.
Brian Overland has considerable experience programming with C++ and teaching basic techniques to others. For ten years at Microsoft, he worked as a C++ programmer and writer, as well as project leader--a unique combination that prepared him well to write lucid, accurate programming books. He is the author of six programming books in all, including C++ in Plain English, Third Edition John Wiley & Sons, 2001. Brian currently is the CEO of Storage Tech LLC, a pioneer in the area of digital record storage.
![]() |
Ask a Question About this Product More... |
![]() |