C++ Without Fear: A Beginner's Guide that Makes You Feel Smart
  • Alternative view 1 of C++ Without Fear: A Beginner's Guide that Makes You Feel Smart
  • Alternative view 2 of C++ Without Fear: A Beginner's Guide that Makes You Feel Smart

C++ Without Fear: A Beginner's Guide that Makes You Feel Smart

4.8 4
by Brian Overland

View All Available Formats & Editions

ISBN-10: 0321246950

ISBN-13: 9780321246950

Pub. Date: 09/27/2004

Publisher: Prentice Hall

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


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.

Product Details

Prentice Hall
Publication date:
Edition description:
Book & CD-ROM
Product dimensions:
9.16(w) x 7.24(h) x 1.01(d)

Table of Contents

Why a New C++ Book?xix
What Else Is New about This Book?xx
Multiple Learning Paths: What Fits You Bestxx
What If You Already Have a Programming Background?xxi
What Is Not Covered?xxi
Why Should Anyone Start with C++?xxii
To Get Started...xxiii
Tips and Tricks: What Do I Watch Out For?xxiii
Chapter 1Your First C++ Programs1
Thinking like a Programmer1
What's Different about C++?6
Building a C++ Program8
Installing Your Own C++ Compiler11
Example 1.1Print a Message12
Advancing to the Next Print Line17
Example 1.2Print Multiple Lines18
Storing Data: C++ Variables20
Introduction to Data Types21
Example 1.3Convert Temperatures23
A Word about Variable Names and Keywords29
Chapter 1 Summary30
Chapter 2Decisions, Decisions33
But First, a Few Words about Data Types33
Decision Making in Programs37
If and if-else37
Example 2.1Odd or Even?41
Introducing Loops44
Example 2.2Print 1 to N48
True and False in C++50
The Increment Operator (++)51
Statements vs. Expressions53
Introducing Boolean (Short-Circuit) Logic54
Example 2.3Testing a Person's Age56
Introducing the Math Library57
Example 2.4Prime-Number Test58
Chapter 2 Summary61
Chapter 3The Handy, All-Purpose "for" Statement65
Loops Used for Counting65
Introducing the "for" Loop66
A Wealth of Examples68
Example 3.1Printing 1 to N with "for"70
Statement Blocks with "for"71
Declaring Loop Variables on the Fly72
Example 3.2Prime-Number Test with "for"73
Comparative Languages 101: The Basic "for" Statement77
Chapter 3 Summary78
Chapter 4Functions: Many Are Called81
The Concept of Function81
Function Calls and the Flow of the Program83
The Basics of Using Functions84
Example 4.1Triangle-Number Function88
Example 4.2Prime-Number Function92
Local and Global Variables95
Recursive Functions97
Example 4.3Greatest Common Factor (GCF)98
Example 4.4Prime Factorization102
Example 4.5Random-Number Generator106
Chapter 4 Summary109
Chapter 5Arrays: We've Got Their Number111
A First Look at C++ Arrays111
Initializing Arrays113
Zero-Based Indexing114
Example 5.1Print Out Elements115
Example 5.2How Random Is Random?117
Strings and Arrays of Strings122
Example 5.3Card Dealer #1123
Example 5.4Card Dealer #2126
Example 5.5Card Dealer #3130
A Word to the Wise135
2-D Arrays: Into the Matrix136
Chapter 5 Summary137
Chapter 6Pointers: Getting a Handle on Data139
The Concept of Pointer139
Declaring and Using Pointers142
Example 6.1The Double-It Function145
Swap: Another Function Using Pointers147
Example 6.2Array Sorter149
Pointer Arithmetic154
Pointers and Array Processing156
Example 6.3Zero Out an Array157
Chapter 6 Summary161
Chapter 7Strings: Analyzing the Text163
Text Storage on the Computer163
It Don't Mean a Thing If It Ain't Got That String165
String-Manipulation Functions166
Example 7.1Building Strings168
Reading String Input172
Example 7.2Get a Number175
Example 7.3Convert to Uppercase177
Individual Characters vs. Strings180
Example 7.4Analyze Input181
The New C++ String Class186
Example 7.5Building Strings with the string Type189
Other Operations on the string Type191
Chapter 7 Summary193
Chapter 8Files: Electronic Storage197
Introducing File-Stream Objects197
How to Refer to Disk Files199
Example 8.1Write Text to a File200
Example 8.2Display a Text File200
Text Files vs. "Binary" Files203
Introducing Binary Operations208
Example 8.3Random-Access Write211
Example 8.4Random-Access Read214
Chapter 8 Summary217
Chapter 9Some Advanced Programming Techniques219
Command-Line Arguments219
Example 9.1Display File from Command Line221
Function Overloading224
Example 9.2Printing Different Types of Arrays226
The do-while Loop228
The switch-case Statement230
Multiple Modules231
Exception Handling234
Example 9.3Exception Handling with GCF239
Chapter 9 Summary242
Chapter 10Getting Yourself Object Oriented245
Why Get Object Oriented?245
A String Parser247
Objects vs. Classes248
Another Example: The Fraction Class249
Object Creation and Destruction250
Inheritance, or Subclassing251
Creating Shared Interfaces252
Polymorphism: True Object Independence253
Polymorphism and Virtual Functions255
What about Reusability?257
Chapter 10 Summary259
Chapter 11The Fraction Class261
Point: A Simple Class261
Private: Members Only (Protecting the Data)263
Example 11.1Testing the Point Class266
Introducing the Fraction Class268
Inline Functions271
Find the Greatest Common Factor273
Find the Lowest Common Multiple275
Example 11.2Fraction Support Functions276
Example 11.3Testing the Fraction Class280
Example 11.4Fraction Arithmetic: add and mult283
Chapter 11 Summary288
Chapter 12Constructors: If You Build It...291
Introducing Constructors291
Multiple Constructors (Overloading)293
The Default Constructor...and a Warning294
Example 12.1Point Class Constructors296
Example 12.2Fraction Class Constructors299
Reference Variables and Arguments (&)302
The Copy Constructor304
Example 12.3Fraction Class Copy Constructor306
Chapter 12 Summary310
Chapter 13Operator Functions: Doing It with Class313
Introducing Class Operator Functions313
Operator Functions As Global Functions316
Improve Efficiency with References318
Example 13.1Point Class Operators320
Example 13.2Fraction Class Operators323
Working with Other Types328
The Class Assignment Function (=)329
The Test-for-Equality Function (==)330
A Class "Print" Function332
Example 13.3The Completed Fraction Class333
Chapter 13 Summary339
Chapter 14What's "new": The StringParser Class343
The "new" Operator343
Objects and "new"345
Allocating Array Data347
Example 14.1Dynamic Memory in Action349
Design for a Parser (Lexical Analyzer)350
Example 14.2The StringParser Class355
Chapter 14 Summary361
Chapter 15What's "this": The String Class363
Introducing the String Class363
Introducing Class Destructors364
Example 15.1A Simple String Class366
"Deep" Copying and the Copy Constructor370
The "this" Keyword372
Revisiting the Assignment Operator374
Writing a Concatenation Function375
Example 15.2The Complete String Class377
Chapter 15 Summary382
Chapter 16Inheritance: What a Legacy385
Subclassing for Fun and Profit385
Example 16.1The FloatFraction Class389
Problems with the FloatFraction Class394
Example 16.2The Completed FloatFraction Class398
Example 16.3The ProperFraction Class399
Private and Protected Members404
Example 16.4Contained Members: Fraction Units406
Chapter 16 Summary410
Chapter 17Polymorphism: Object Independence413
A Different Approach to the FloatFraction Class413
Virtual Functions to the Rescue!415
Example 17.1The Revised FloatFraction Class418
"Pure Virtual" and Other Arcane Matters423
Abstract Classes and Interfaces424
Why cout Is Not Truly Polymorphic426
Example 17.2True Polymorphism: The Printable Class427
A Final Word (or Two)431
A Final Final Word432
Chapter 17 Summary433
Appendix AC++ Operators435
Appendix BIntrinsic Data Types439
Appendix CC++ Syntax Summary441
Literal Constants441
Basic Expression Syntax441
Basic Statement Syntax442
Control Structures443
Special Control Statements445
Data Declarations446
Function Declarations447
Class Declarations448
Appendix DASCII Codes451
Appendix ECommon Library Functions453
String Functions453
Data-Conversion Functions454
Single-Character Functions455
Math Functions455
Appendix FGlossary of Terms459

Customer Reviews

Average Review:

Write a Review

and post it to your social network


Most Helpful Customer Reviews

See all customer reviews >

C++ Without Fear: A Beginner's Guide that Makes You Feel Smart 4.8 out of 5 based on 0 ratings. 4 reviews.
atila More than 1 year ago
This book is extremely well written. Its structure is superb. Brian manages to lead you by the hand, providing plenty of examples with clear explanations. With each chapter I gained an increase in confidence and ability. I almost didn't buy this book because of it's cover. That would have been a mistake. I would highly recommended this book.
Guest More than 1 year ago
After reading several reviews of C++ books i was at a loss like many.. so many choices.. which one is best? Well i took some advice from my frined.. he said 'go to the local BN and read a few and focus on a subject that you dont know what it is.. and see if it makes sense to you.' Well i read parts of this as well as many others.. and ive read part of it as of now.. very very well written. Easily explained... also one thing to keep in mind, this book references stuff that is further ahread in examples, but he is sure to explain them soon after he uses them. Very highly recommended... I absolutly HATE to read, but this book.. i want to read it some more.. it has some odd power that inspires me to keep learning.. so pick it up today! Only at 24.99 bucks you really cant go wrong.
Guest More than 1 year ago
This is a great book if you are looking to get into programming. It is very basic, and the author gives excellent examples, along with the, 'How and Why' it works. Like all beginner Programming Books, you are led through the basics and you gain the gradual knowledge as you go. The author provides many sidebars, but not too many as to distract you, which are designed to give you the added knowledge of the language. One of the nice things about this book is the easy to follow language the author uses to explain how to program in C++. I have read many C/C++ books over the years, and this has been by far, the easiest books to learn from. This is by far the best programming book I have read to date, but there are a few shortcomings. The author included a free C++ compiler, GCC, but doesn't talk about how to compile on Linux or through the command line. This was the biggest drawback for me. When the author gives the excercises to do, he usually gives the answer away when giving the excercise. I feel that many of these excercises would be best handled if the user had to look it up his or herself. This is a great book for the novice, and yes, if you are just beginning, why would you need an IDE and graphics if you have never programmed before? Buy this book, you will not be disappointed.
Guest More than 1 year ago
Overland certainly doesn't waste any time. In his preface, he offers to qushortly into Chapter 1, you will be writing your first program. Granted, it just prints something on the screen. But you get to do a full loop of writing, compiling and running. An approach I heartily concur with. It helps build up your confidence in yourself. By sticking to this method throughout the book, Overland keeps you motivated. No small thing, especially if you want to use this book outside a ickly get to showing you how to write complete programs, without having to know most of the C++ syntax. Indeed, classroom, where no one is telling you to keep going. Think of the book as offering a continual stream of deliverables to you. He steers away from advanced topics like templates and the Standard Template Library. These are vital. But later. Nor does he discuss 'union'. Not an advanced topic. But it tends to be so little used that he found he can reduce conceptual clutter by omitting it.