Always Learning

Advanced Search

C++ Without Fear

C++ Without Fear

A Beginner's Guide That Makes You Feel Smart

Brian Overland

Sep 2004, Paperback with CD-ROM, 528 pages
ISBN13: 9780321246950
ISBN10: 0321246950
This product has been replaced by C++ Without Fear
£23.04

This title cannot be purchased online
  • Print pagePrint page
  • Email this pageEmail page
  • Write a reviewWrite a review
  • Share

If you've always wanted to learn how to program a computer, or to learn the popular C++ programming language, here's the perfect book and CD to get you started. You'll find everything you need patiently explained and clearly illustrated, from general programming concepts and techniques to the particulars of the C++ language. In no time, you'll be writing your own programs!

Yes, programming can be a complex task, and C++ is a language often used by professionals. In fact, many of the coolest games , graphics, and Internet applications are created with C++. But the language, like the monster on the cover, need not be all that fearsome. Broken down to its essentials, and enhanced by simple examples and practical exercises, you'll be amazed at the quick progress you can make.

With C++ Without Fear, you will

  • Learn the basics of C++ programming
  • Get started writing your own programs
  • See how and why each piece of a program does what it does
  • Create useful and reusable program code
  • Understand object-oriented programming--for once explained in simple, down-to-earth terms

Whether you wish to learn C++ programming for pleasure--and you'll discover here how much fun it can be--or might be considering a career in programming, this book is an intelligent first step.

The accompanying CD-ROM contains a free C++ compiler for writing and running C++ programs, which will let you get started right away. It also includes all the examples and answers to all the exercises in the book. The CD-ROM will run on any PC running MS-DOS or Windows.



If you've always wanted to learn how to program a computer, or to learn the popular C++ programming language, here's the perfect book and CD to get you started. You'll find everything you need patiently explained and clearly illustrated, from general programming concepts and techniques to the particulars of the C++ language. In no time, you'll be writing your own programs!

Yes, programming can be a complex task, and C++ is a language often used by professionals. In fact, many of the coolest games , graphics, and Internet applications are created with C++. But the language, like the monster on the cover, need not be all that fearsome. Broken down to its essentials, and enhanced by simple examples and practical exercises, you'll be amazed at the quick progress you can make.

With C++ Without Fear, you will

  • Learn the basics of C++ programming
  • Get started writing your own programs
  • See how and why each piece of a program does what it does
  • Create useful and reusable program code
  • Understand object-oriented programming--for once explained in simple, down-to-earth terms

Whether you wish to learn C++ programming for pleasure--and you'll discover here how much fun it can be--or might be considering a career in programming, this book is an intelligent first step.

The accompanying CD-ROM contains a free C++ compiler for writing and running C++ programs, which will let you get started right away. It also includes all the examples and answers to all the exercises in the book. The CD-ROM will run on any PC running MS-DOS or Windows.



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.

An experienced and highly regarded programming author makes C++ easy to learn--and fun--for complete novices.

° The first to meet new market needs for a true beginner's C++ book--one that is perfect for beginning programmers in today's world who may not know any programming languages at all.

° Quickly learn programming basics and write your first C++ programs.

° Deepens learning through well-illustrated explanations, examples, and exercises.

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.