Home > Store

C++: A Dialog: Programming with the C++ Standard Library

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

C++: A Dialog: Programming with the C++ Standard Library

Book

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

About

Features

  • NEW - C++ from the ground up, while taking full advantage of the power the Standard Template Library offers.
    • Provides a faster path to true C++ mastery than is available from books that avoid the Standard Template Library.

  • Commercial-grade C++ compiler—CD-ROM contains Borland's advanced C++ compiler, which can be used to run all programs in the book—and any other program students create.
    • Gives students a powerful, high-value programming tool they can utilize for years to come.

  • Proven, friendly teaching method—Teaches C++ and STL through a conversation between an expert and beginner, in which the expert carefully guides the beginner through the areas of C++/STL that typically cause the greatest confusion.
    • Teaches beginners more effectively, overcoming typical obstacles more rapidly, and retaining more of what they learn.

  • Companion Web site—Authors companion Web site, www.steveheller.com, contains software updates, error corrections, and a bulletin board for ongoing conversations amongst readers and the author.
    • Lets students ask questions of the author and take advantage of his additional online learning resources.

  • CD-ROM—Contains a commercial-grade version of Borland's powerful C++ compiler.
    • Can run all the programs presented in the book as well as any other C++/STL program students choose to write.

Description

  • Copyright 2002
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-009402-1
  • ISBN-13: 978-0-13-009402-5

Simply the best way for beginners to learn standard C++.

C++: A Dialog is the easiest, most effective way for beginners to learn C++ programming.

Steve Heller teaches C++ from scratch, through a one-on-one conversation with an intelligent beginner who asks the questions you'd ask. Heller's unique dialog format is brilliantly designed to clarify the concepts you might otherwise find confusing, so you can quickly learn today's most powerful and valuable C++ development techniques.

Heller takes you from the absolute fundamentals through the construction of a complete inventory application, including a simple but effective user interface. Along the way, you won't just learn C++ features: you'll see exactly how professional programmers bring them together and put them to work.

Unlike many beginners' books, C++: A Dialog uses industry-standard C++ and the latest standard libraries—giving you skills you can use with any standard C++ toolset, in any programming environment. You even get all the example code and a standard C++ compiler on CD-ROM so you can write and compile your own standard C++ programs on any 32-bit Microsoft Windows platform.

CD-ROM INCLUDED

The accompanying CD-ROM contains the commercial-grade Borland C++ 5.5 compiler and its associated libraries, which supports the latest ANSI/ISO C++ standards, including the STL (Standard Template Library) framework and C++ templates.

Sample Content

Online Sample Chapter

Introduction to Programming in C++

Downloadable Sample Chapter

Click here for a sample chapter for this book: 0130094021.pdf

Table of Contents



List of Figures.


Foreword.


Preface.


Acknowledgments.


Letter from a Novice.


1. Introduction to Programming.

Definitions. Baby Steps.



2. Hardware Fundamentals.

Definitions. Objectives of This Chapter. Inside the Box. The Binary Number System. Exercises. Using the 16-bit Register Names. Review. Conclusion. Answers to Exercises.



3. Basics of Programming.

Definitions. Objectives of This Chapter. Rapid and Accurate Calculation. The Compiler. How the CPU Stores and Manipulates Data in Memory. The Layout of Data in Memory. Exercises, First Set. The char and string Types. using, namespace, and std. int main(). Exercises, Second Set. Input and Output. Changing the Course of Execution. The while Loop. Exercises, Third Set. Our First Slightly Realistic Program. Exercises, Fourth Set. Review. Conclusion. Answers to Exercises.



4. More Basics.

Objectives of This Chapter. Algorithmic Thinking. Handling Any Number of Prizes. Index Variables. The Selection Sort. Program Failure. Review. Exercises. Conclusion. Answers to Exercises.



5. Functional Literacy.

Definitions. Objectives of This Chapter. Modules vs. Functions. Using a Function. Software Is a Virtual Computer. Scope of Variables. The Disadvantages of Global Variables. More on Using the Stack. Review. Exercises. Conclusion. Answers to Exercises.



6. Taking Inventory.

Definitions. Objectives of This Chapter. User-defined Data Types. The StockItem class. More Definitions. Concrete Data Types. The class Scope. More about the StockItem class Interface. Working around the Standard Library. Reference Arguments. Checking Inventory for a Misplaced Item. Review. Exercises. Conclusion. Answers to Exercises.



7. Creating a homegrown string class.

Objectives of This Chapter. C String Literals vs. strings. Dynamic Memory Allocation via new and delete. Constructing a string from a C String. Assignment Operator Issues. Solving the Assignment Operator Problem. The const Modifier for Reference Arguments. Calling operator=. Review. Exercises. Conclusion.



8. Finishing our homegrown string class.

Objectives of This Chapter. The string Copy Constructor. More about the private Access Specifier. First Review. Adding Further Facilities to our string class. Initialization vs. Assignment. Second Review. Exercises. Conclusion. Answers to Exercises.



9. Inheritance.

Definitions. Objectives of This Chapter. Taking Inventory. Adding ReorderItems to the Inventory class. Adding Expiration Dates. The protected Access Specifier. static Member Functions. The stream classes. More about stringstream. Review. Exercises. Conclusion.



10. Polymorphism.

Definitions. Objectives of This Chapter. Introduction to Polymorphism. Exercises, First Set. Polymorphic Objects. More Definitions. Why We Need Polymorphic Objects. Implementing Safe Polymorphism. Reimplementing the Standard Member Functions for the New Version of StockItem. voiding an Infinite Regress During Construction. Reference Counting. Sharing a Worker Object. Why We Need m_Count in StockItem. Review. Exercises, Second Set. Conclusion.



11. The Home Inventory Project.

Definitions. Objectives of This Chapter. Data Items for the Home Inventory Project. The Manager/Worker Idiom Again. Hiding Unnecessary Information from the class User. Saving the Number of the Elements in the File. Creating a Data File Programmatically. Adding the Ability to Edit a Record. The New Member Functions of HomeItemMusic. Review. Exercises. Conclusion.



12. More on the Home Inventory Project.

Definitions. Objectives of This Chapter. Extending the Functionality of strings. How to Implement Our New string Functionality. The Include Guard. Lessons of the xstring class Implementation. Case-Insensitive Searching. Searching for an Item by a Substring. Putting It All Together. How Software Development Really Works. Review. Conclusion.



13. Analyzing the Home Inventory Project.

Definitions. Objectives of This Chapter. The Final Version of the Home Inventory Program. Using a namespace to Group Utility Functions. The Functions of the HomeUtility namespace. Checking the Inventory. Finishing up the HomeItem class. Are We Having Fun Yet? Review. Exercises. Conclusion.



Appendix A. Tying up Loose Ends.

Wrapping Up.



Appendix B. Glossary.

Special Characters. A 995. B 998. C 1000. D 1006. E 1009. F 1010. G 1013. H 1013. I 1014. K 1017. L 1017. M 1019. N 1021. O 1024. P 1026. R 1029. S 1032. T 1037. U 1038. V 1040. W 1041. Y 1041. Z 1041.



About the Author.


Bibliography.


Index.

Preface

Preface

Is this book for you? If you're a programmer in a language other than C++ and you want to upgrade your skills, then you shouldn't have much difficulty figuring that out for yourself by reading a few pages. But what if you have no previous programming experience? In that case, here's a little quiz that may help you decide:

  1. 1.Do you want to know how the programs in your computer work inside and how to write some of your own?
  2. 2.Are you willing to exert yourself mentally to learn a complex technical subject?
  3. 3.Do you have a sense of humor?

If you've answered yes to these questions and follow through with the effort required, then you will get a lot out of this book.

The common wisdom states that programming is a difficult subject that should be reserved for a small number of specialists. One of the main reasons that I have written this book is that I believe this attitude is wrong; it is possible, and even desirable, for you to learn how programs work and how to write them. Those who don't understand how computers perform their seemingly magical feats are at an ever-increasing disadvantage in a society ever more dependent on these extraordinary machines.

Regardless of the topic, I can see no valid reason for a book to be stuffy and dry, and I've done everything possible to make this one approachable. However, don't let the casual tone fool you into thinking that the subject is easy; there is no royal road to programming, any more than there is to geometry. Especially if you have no prior experience in programming, C++ will stretch your mind more than virtually any other area of study.

Assuming that you want to learn C++, why should you read this book rather than any of dozens of other introductory C++ books? One difference between this book and other introductory books is that many of them still don't use the C++ standard library, a very important part of the C++ language definition. We'll make use of some of the features of the standard library in this book, to get you started on learning this large and complex part of the C++ language.

However, we certainly won't cover it in its entirety; that would require much more room that we can devote to it here. In fact, many books can be and have been written about the standard library alone, although I don't know of any that would be suitable for novices to programming.

But there is one ingredient that makes this book unique: the participation of a real, live person who didn't already know the material before reading it, namely Susan Heller, my wife. Her main contribution has been to read every line of the book, starting with the first draft, and to ask questions via e-mail about anything she didn't understand. I answered her questions, also by e-mail, until both of us were satisfied that she understood the material in question and that the text was clear. After the text was otherwise complete, I extracted appropriate parts of the e-mail exchanges, edited them for spelling, punctuation, and so forth, and included them in the text where they will be most useful to the reader.

For this latest version of the book, we have discussed the changes caused by the adoption of the standard library. As a result of our discussions, I have added to and modified the existing e-mail conversations as appropriate so that they make sense in the context of those changes. However, Susan still has the final say on what goes in her side of these conversations, so they are still authentic conversations.

Of course, these exchanges do take up room in the book that might otherwise be filled with more information about C++ and programming. Therefore, if you want to get the absolute maximum of new information per page, you might want to select another book such as Bjarne Stroustrup's excellent The C++ Programming Language (ISBN 0-201-88954-4), or perhaps Accelerated C++, by Andrew Koenig and Barbara Moo (ISBN 0-201-70353-X). However, the vast majority of comments I've received from readers of my other books for beginners have indicated that they found my approach very helpful, and I suspect that most readers of this book will feel the same.

Susan has written an account of part of her involvement in this project, which immediately follows this Preface. I recommend that you read that account before continuing with the technical material following it, as it explains how and why she has contributed to making your task easier and more enjoyable.

Speaking of Susan, here is a bit of correspondence between us on the topic of how one should read this book, which occurred after her first reading of what is now Chapter 2, "Hardware Fundamentals", and Chapter 3, "Basics of Programming".

Susan: Let me say this: to feel like I would truly understand it, I would really need to study this about two more times. Now, I could do this, but I am not sure you would want me to do so. I think reading a chapter once is enough for most people.

Steve: As a matter of fact, I would expect the reader of my book to read and study these chapters several times if necessary; for someone completely new to programming, I imagine that it would be necessary. Programming is one of the most complex human disciplines, although it doesn't take the mathematical skills of a subject such as nuclear physics, for example. I've tried to make my explanations as simple as possible, but there's no way to learn programming (or any other complex subject) without investing a significant amount of work and thought.

After she had gone through the text a number of times and had learned a lot from the process, we continued this discussion as follows:

Susan: Well then, maybe this should be pointed out in a Preface or something. Of course, it would eventually be obvious to the reader as it was to me, but it took me a while to come to that conclusion. The advantage of knowing this in advance is that maybe I would not be so discouraged that I was not brilliant after one read of a chapter.

Steve: I will indeed mention in the preface that the reader shouldn't be fooled by the casual tone into thinking that this is going to be a walk in the park. In any event, please don't be discouraged. It seems to me that you have absorbed a fair amount of very technical material with no previous background; that's something to be proud of!

We'll be hearing from Susan many more times in the course of the book. She will be checking in frequently in the form of extracts from the e-mail discussion we engaged in during the testing and revising process. I hope you will find her comments and my replies add a personal touch to your study of this technical material.

While we're on the topic of your studying, this would be a good time to tell you how to get updates and help with any errors you might find in the book or with any other questions you might have. The best way is to visit my WWW site, steveheller.com. My e-mail address is steve@steveheller.com

In the event that you enjoy this book and would like to tell others about it, you might want to write an online review on Amazon.com, which you can do by visiting my home page and following the links to the "customer reviews" on Amazon.

Now that those preliminaries are out of the way, let's proceed. The next voice you will hear is that of Susan, my test reader. I hope you get as much out of her participation in this book as I have.

Updates

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.

Overview


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.

Surveys

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.

Newsletters

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.

Security


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

Children


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

Marketing


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.

Choice/Opt-out


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.

Links


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