Home > Store

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

Register your product to gain access to bonus material or receive a coupon.

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

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale



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.


  • Copyright 2005
  • Edition: 1st
  • Premium Website
  • ISBN-10: 0-321-24695-0
  • ISBN-13: 978-0-321-24695-0

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.

Sample Content

Table of Contents


    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?


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.



Download the Index file related to this title.


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020