More About
This Textbook

Overview

With over 250,000 sold, Harvey and Paul Deitel's C++ How to Program is the world's best-selling introduction to C++ programming. Now, this classic has been thoroughly updated! The Deitels' groundbreaking How to Program series offers unparalleled breadth and depth of programming concepts and intermediate-level topics for further study. The books in this series feature hundreds of complete, working programs with thousands of lines of code. Deitels' C++ How to Program is the most comprehensive, practical introduction to C++ ever published-with hundreds of hands-on exercises, roughly 250 complete programs written and documented for easy learning, and exceptional insight into good programming practices, maximizing performance, avoiding errors, debugging, and testing. The updated Fifth Edition now includes a new early classes pedagogy-classes and objects are introduced in Chapter 3 and used throughout the book as appropriate. The new edition uses string and vector classes to make earlier examples more object-oriented. Large chapters are broken down into smaller, more manageable pieces. A new OOD/UML ATM case study replaces the elevator case study of previous editions, and UML in the OOD/UML case study and elsewhere in the book has been upgraded to UML 2. The Fifth Edition features new mini case studies (e.g., GradeBook and Time classes). An employee hierarchy replaces Point/Circle/Cylinder to introduce inheritance and polymorphism. Additional enhancements include tuned treatment of exception handling, new “Using the Debugger” material and a new "Before You Begin" section to help readers get set up properly. Also included are separate chapters onrecursion and searching/sorting. The Fifth Edition retains every key concept and technique ANSI C++ developers need to master: control statements, functions, arrays, pointers and strings, classes and data abstraction, operator overloading, inheritance, virtual functions, polymorphism, I/O, templates, exception handling, file processing, data structures, and more. It also includes a detailed introduction to Standard Template Library (STL) containers, container adapters, algorithms, and iterators. The accompanying CD-ROM includes all the source code from the book. A valuable reference for programmers and anyone interested in learning the C++ programming language and object-oriented development in C++.

Although there are way too many C++ books to choose from, C++ How to Program, Second Edition, is a classic for students with little or no programming experience. This second edition adds three new chapters, and covers the latest additions to the language plus the new ANSI/ISO C++ standard library. The first part of the book discusses datatypes, input/output, control structures, functions, arrays, pointers, and strings. The book then moves on to explain data abstraction with classes, objects, and operator overloading. Chapters 9 through 14 teach you inheritance, virtual functions, polymorphism, C++ style stream-oriented input/output, screen files, and character arrays.

Editorial Reviews

From Barnes & Noble

Fatbrain Review

Although there are way too many C++ books to choose from, C++ How to Program, Second Edition, is a classic for students with little or no programming experience. This second edition adds three new chapters, and covers the latest additions to the language plus the new ANSI/ISO C++ standard library. The first part of the book discusses datatypes, input/output, control structures, functions, arrays, pointers, and strings. The book then moves on to explain data abstraction with classes, objects, and operator overloading. Chapters 9 through 14 teach you inheritance, virtual functions, polymorphism, C++ style stream-oriented input/output, screen files, and character arrays.

Two of the more recent major additions to C++ are templates and exception handling. You will get a clear understanding of these additions in chapters 12 and 13. Assumming that you have built a solid comprehension of the language, the book then takes you to dynamic data structures such as linked lists, queues, and trees. Additional coverage includes bit, character and string manipulation, and the processor. The last part of the book is devoted to the latest C++ enhancements and ANSI/ISO C++ Draft Standard, and discusses class string, string stream processing, the Standard Template Library (STL), and other recent additions to C++. The appendices contain operator precedence, the ASCII character set, and number systems.

This text puts strong emphasis on pedagogy. Every chapter begins with a set of objectives and an outline, and then moves onto common programming errors, good programming practices, performing tips, portability tips, and more. The chapters also include bullet-list-styleand alphabetized terminology sections, self-review exercises and answers. Exercises range from simple questions to lengthy programming problems to major projects.

Booknews

This is an exciting time in the C++ world, according to the MIT graduate authors of this classic introductory programming college text. Within the context of a new ANSI/ISO C++ standard, the major upgrade of this iteration (2d ed., 1998) is its large-scale case study on object-oriented design using Unified Modeling Language (UML). Each of the 21 chapters includes conventional structured programming, but concludes with a "thinking about objects" section using UML. Appendices support the text. The CD-ROM includes Microsoft Visual C++ 6 introductory edition. An ancillary package is available. The authors are the principals of a corporate training and content-creation organization and the authors of books on programming with Java and C-languages. Annotation c. Book News, Inc., Portland, OR (booknews.com)

Related Subjects

Meet the Author

Dr. Harvey Deitel is one of the world's leading computer science instructors and seminar presenters, and author of more than a dozen books. He worked on the pioneering operating system teams in industry and academia that developed many of the techniques at the heart of operating systems like UNIX®, Windows NT™ and OS/2™.

Read an Excerpt

PREFACE:

Preface

C++ How to Program: Third Edition

We performed an extensive review process on this Third Edition that led to thousands of polishing changes. We also completely updated the programs in the text to conform to the C++ standard's use of namespaces.

The major new feature of this Third Edition is a complete, fully-implemented case study on object-oriented design using the Unified Modeling Language (UML). We felt that a commitment to larger-scale object-oriented design projects is something that has been lacking in introductory programming textbooks. This optional case study is highly recommend because it will considerably enhance the students' experience in a first-year university programming sequence. This case study provides students with an opportunity to immerse themselves in a 1000+ line C++ program that was carefully scrutinized by a team of distinguished industry and academic reviewers.

In the previous editions of this book, we included special "Thinking About Objects" sections at the ends of Chapters 1 through 7. These sections walked the student through the steps needed to design the software simulator for an elevator system. We asked the student to complete these steps and to implement their design in C++. For C++ How to Program: Third Edition, we have completely remodeled this case study. At the ends of Chapters 1 through 7 and the end of Chapter 9, we use the "Thinking About Objects" sections to present a carefully paced introduction to object-oriented design using the UML. The UML is now the most widely used graphical representation scheme for modeling object-orientedsystems. The UML is a complex, feature-rich graphical language. In our "Thinking About Objects" sections, we present a concise, simplified subset of these features. We then use this subset to guide the reader through a first design experience with the UML intended for the novice object-oriented designer/programmer. We present this case study in a fully solved format. This is not an exercise; rather, it is an end-to-end learning experience that concludes with a detailed walkthrough of the C++ code.

In each of the first five chapters we concentrate on the "conventional" methodology of structured programming, because the objects we will build will be composed, in part, of structured-program pieces. We then end each chapter with a "Thinking About Objects" section in which we present an introduction to object orientation using the Unified Modeling Language (UML). Our goal in these "Thinking About Objects" sections is to help students develop an object-oriented way of thinking, so they can immediately put to use the object-oriented programming concepts that they begin learning in Chapter 6. In the first of these sections at the end of Chapter 1, we introduce basic concepts (i.e., "object think") and terminology (i.e., "object speak"). In the optional "Thinking About Objects" sections at the ends of Chapters 2 through 5 we consider more substantial issues as we attack a challenging problem with the techniques of object-oriented design (OOD). We analyze a typical problem statement that requires a system to be built, determine the objects needed to implement that system, determine the attributes the objects will need to have, determine the behaviors these objects will need to exhibit and specify how the objects will need to interact with one another to meet the system requirements. We do all this even before we discuss how to write object-oriented C++ programs. In the "Thinking About Objects" sections at the ends of Chapters 6, 7 and 9, we discuss a C++ implementation of the object-oriented system we designed in the earlier chapters.

This case study is significantly larger than any other project attempted in the book. We feel that the student gains significant experience by following this complete design and implementation process. This project forced us to incorporate topics that we do not discuss in any other section of the book, including object interaction, an in-depth discussion of handles, the philosophy of using references vs. pointers and the use of forward declarations to avoid the circular include problem. This case study will help prepare students for the kinds of substantial projects encountered in industry.

"Thinking About Objects" Sections
In Chapter 2, we begin the first phase of an object-oriented design (OOD) for the elevator simulator—identifying the classes needed to implement the simulator. We also introduce the UML use case, class and object diagrams and the concepts of associations, multiplicity, composition, roles and links.

In Chapter 3, we determine many of the class attributes needed to implement the elevator simulator. We also introduce the UML statechart and activity diagrams and the concepts of events and actions as they relate to these diagrams.

In Chapter 4, we determine many of the operations (behaviors) of the classes in the elevator simulation. We also introduce the UML sequence diagram and the concept of messages sent between objects.

In Chapter 5, we determine many of the collaborations (interactions between objects in the system) needed to implement the elevator system and represent these collaborations using the UML collaboration diagram. We also include a bibliography and a list of Internet and World Wide Web resources that contain the UML 1.3 specifications and other reference materials, general resources, tutorials, FAQs, articles, whitepapers and software.

In Chapter 6, we use the UML class diagram developed in previous sections to outline the C++ header files that define our classes. We also introduce the concept of handles to objects in the system and we begin to study how to implement handles in C++.

In Chapter 7, we present a complete elevator simulator C++ program (approximately 1000 lines of code) and a detailed code walkthrough. The code follows directly from the UML-based design created in previous sections and employs our good programming practices, including the use of static and const data members and functions. We also discuss dynamic-memory allocation, composition and object interaction via handles and how to use forward declarations to avoid the circular include problem.

In Chapter 9, we update the elevator simulation design and implementation to incorporate inheritance. We also suggest further modifications so that the student may then design and implement, using the tools presented in the previous sections.

We sincerely hope that this newly updated elevator simulation case study provides a challenging and meaningful experience for both students and instructors. We employ a carefully developed, incremental object-oriented process to produce a UML-based design for our elevator simulator. From this design, we produce a substantial working C++ implementation using key programming notions, including classes, objects, encapsulation, visibility, composition and inheritance. We would be most grateful if you would take a moment to send your comments, criticisms and suggestions for improving this case study to us at deitel@deitel.com.

About this Book

C++ How to Program contains a rich collection of examples, exercises and projects drawn from many fields to provide the student with a chance to solve interesting real-world problems. The book concentrates on the principles of good software engineering and stresses program clarity. We avoid arcane terminology and syntax specifications in favor of teaching by example.

This book is written by educators who spend most of their time teaching and writing about edge-of-the-practice programming languages.

The text places a strong emphasis on pedagogy. For example, virtually every new concept of either C++ or object-oriented programming is presented in the context of a complete, working C++ program immediately followed by a window showing the program's output. Reading these programs is much like entering and running them on a computer. We call this our "live-code approach."

Among the other pedagogical devices in the text are a set of Objectives and an Outline at the beginning of every chapter; Common Programming Errors, Good Programming Practices, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips enumerated in, and summarized at, the end of each chapter; comprehensive bullet-list-style Summary and alphabetized Terminology sections in each chapter; Self-Review Exercises and Answers in each chapter; and the richest collection of Exercises in any C++ book.

The exercises range from simple recall questions to lengthy programming problems to major projects. Instructors requiring substantial term projects will find many appropriate problems listed in the exercises for Chapters 3 through 21. We have put a great deal of effort into the exercises to enhance the value of this course for the student.

In writing this book, we have used a variety of C++ compilers. For the most part, the programs in the text will work on all ANSI/ISO compilers.

This text is based on the C++ programming language as developed by Accredited Standards Committee X3, Information Technology and its Technical Committee X3J16, Programming Language C++, respectively. This language was approved by the International Standards Organization (ISO). For further details, contact:

X3 Secretariat
1250 Eye Street NW
Washington DC 20005

The serious programmer should read these documents carefully and reference them regularly. These documents are not tutorials. Rather they define C++ and C with the extraordinary level of precision that compiler implementors and "heavy-duty" developers demand.

We have carefully audited our presentation against these documents. Our book is intended to be used at the introductory and intermediate levels. We have not attempted to cover every feature discussed in these comprehensive documents.

Objectives
Each chapter begins with a statement of objectives. This tells the student what to expect and gives the student an opportunity, after reading the chapter, to determine if he or she has met these objectives. It is a confidence builder and a source of positive reinforcement.

Quotations
The learning objectives are followed by a series of quotations. Some are humorous, some are philosophical and some offer interesting insights. Our students enjoy relating the quotations to the chapter material. You may appreciate some of the quotations more after reading the chapters.

Outline
The chapter outline helps the student approach the material in top-down fashion. This, too, helps students anticipate what is to come and set a comfortable and effective learning pace.

Sections
Each chapter is organized into small sections that address key C++ topics.

13,741 Lines of Syntax-Colored Code in 268 Example Programs (with Program Outputs)
We present C++ features in the context of complete, working C++ programs; each program is immediately followed by a window containing the outputs produced when the program is run—we call this our "live-code approach." This enables the student to confirm that the programs run as expected. Relating outputs back to the program statements that produce those outputs is an excellent way to learn and to reinforce concepts. Our programs exercise the diverse features of C++. Reading the book carefully is much like entering and running these programs on a computer. The code is "syntax colored" with C++ keywords, comments and other program text each appearing in different colors. This makes it much easier to read the code—students will especially appreciate the syntax coloring when they read the many more substantial programs we present.

469 Illustrations/Figures
An abundance of colorized charts and line drawings is included. The discussion of control structures in Chapter 2 features carefully drawn flowcharts. (Note: We do not teach the use of flowcharting as a program development tool, but we do use a brief flowchart-oriented presentation to specify the precise operation of C++'s control structures.) Chapter 15, "Data Structures," uses colorized line drawings to illustrate the creation and maintenance of linked lists, queues, stacks and binary trees. The remainder of the book is abundantly illustrated.,

625 Programming Tips We have included six design elements to help students focus on important aspects of program development, testing and debugging, performance and portability. We highlight hundreds of these tips in the form of Good Programming Practices, Common Programming Errors, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips. These tips and practices represent the best we have been able to glean from almost six decades (combined) of programming and teaching experience. One of our students—a mathematics major—told us recently that she feels this approach is somewhat like the highlighting of axioms, theorems and corollaries in mathematics books; it provides a basis on which to build good software.

112 Good Programming Practices:Good Programming Practices are highlighted in the text. They call the student's attention to techniques that help produce better programs. When we teach introductory courses to nonprogrammers, we state that the "buzzword" of each course is "clarity," and we tell the students that we will highlight (in these Good Programming Practices) techniques for writing programs that are clearer, more understandable and more maintainable.

216 Common Programming Errors: Students learning a language—especially in their first programming course—tend to make certain kinds of errors frequently. Focusing on these Common Programming Errors helps students avoid making the same errors. It also helps reduce long lines outside instructors' offices during office hours!

87 Performance Tips: In our experience, teaching students to write clear and understandable programs is by far the most important goal for a first programming course. But students want to write the programs that run the fastest, use the least memory, require the smallest number of keystrokes, or dazzle in other nifty ways. Students really care about performance. They want to know what they can do to "turbo charge" their programs. So we have include Performance Tips to highlight opportunities for improving program performance.

37 Portability Tips: Software development is a complex and expensive activity. Organizations that develop software must often produce versions customized to a variety of computers and operating systems. So there is a strong emphasis today on portability, i.e., on producing software that will run on a variety of computer systems with few, if any, changes. Many people tout C++ as an appropriate language for developing portable software, especially because of C++'s close relationship to ANSI/ISO C and the fact that ANSI/ISO C++ is the global C++ standard. Some people assume that if they implement an application in C++, the application will automatically be portable. This is simply not the case. Achieving portability requires careful and cautious design. There are many pitfalls. We include numerous Portability Tips to help students write portable code.

146 Software Engineering Observations: The object-oriented programming paradigm requires a complete rethinking about the way we build software systems. C++ is an effective language for performing good software engineering. The Software Engineering Observations highlight techniques, architectural issues and design issues, etc. that affect the architecture and construction of software systems, especially large-scale systems. Much of what the student learns here will be useful in upper-level courses and in industry as the Student begins to work with large, complex real-world systems.

27 Testing and Debugging Tips: This "tip type" may be misnamed. When we decided to incorporate Testing and Debugging Tips into this new edition, we thought these tips would be suggestions for testing programs to expose bugs and suggestions for removing those bugs. In fact, most of these tips tend to be observations about capabilities and features of C++ that prevent bugs from getting into programs in the first place.

Summary
Each chapter ends with additional pedagogical devices. We present an extensive, bulletlist-style Summary in every chapter. This helps the student review and reinforce key concepts. There is an average of 37 summary bullets per chapter.

Terminology
We include a Terminology section with an alphabetized list of the important terms defined in the chapter—again, further reinforcement. There is an average of 72 terms per chapter.

Summary of Tips, Practices and Errors
We collect and list from the chapter the Good Programming Practices, Common Programming Errors, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips.

554 Self-Review Exercises and Answers (Count Includes Separate Parts)
Extensive Self-Review Exercises and Answers to Self-Review Exercises are included for self study. This gives the student a chance to build confidence with the material and prepare to attempt the regular exercises.

877 Exercises (Count Includes Separate Parts; 1431 Total Exercises)
Each chapter concludes with a substantial set of exercises including simple recall of important terminology and concepts; writing individual C++ statements; writing small portions of C++ functions and classes; writing complete C++ functions, classes and programs; and writing major term projects. The large number of exercises enables instructors to tailor their courses to the unique needs of their audiences and to vary course assignments each semester. Instructors can use these exercises to form homework assignments, short quizzes and major examinations.

550 page Instructor's Manual with Solutions to the Exercises
The solutions for the exercises are included on the Instructor's CD and on the disks available only to instructors through their Prentice Hall representatives. NOTE: Please do not write to us requesting the instructor's CD. Distribution of this CD is limited strictly to college professors teaching from the book. Instructors may obtain the solutions manual only from their Prentice Hall representatives. Solutions to approximately half of the exercises are included on the C++ Multimedia Cyber Classroom: Third Edition CD (available September 2000; please see the last few pages of this book for ordering instructions).

4523 Index Entries (Total of 7653 Counting Multiple References)
We have included an extensive Index at the back of the book. This helps the student find any term or concept by keyword. The Index is useful to people reading the book for the first time and is especially useful to practicing programmers who use the book as a reference. Most of the terms in the Terminology sections appear in the Index (along with many more index items from each chapter). Thus, the student can use the Index in conjunction with the Terminology sections to be sure he or she has covered the key material of each chapter.

Preface

Preface

C++ How to Program: Third Edition

We performed an extensive review process on this Third Edition that led to thousands of polishing changes. We also completely updated the programs in the text to conform to the C++ standard's use of namespaces.

The major new feature of this Third Edition is a complete, fully-implemented case study on object-oriented design using the Unified Modeling Language (UML). We felt that a commitment to larger-scale object-oriented design projects is something that has been lacking in introductory programming textbooks. This optional case study is highly recommend because it will considerably enhance the students' experience in a first-year university programming sequence. This case study provides students with an opportunity to immerse themselves in a 1000+ line C++ program that was carefully scrutinized by a team of distinguished industry and academic reviewers.

In the previous editions of this book, we included special "Thinking About Objects" sections at the ends of Chapters 1 through 7. These sections walked the student through the steps needed to design the software simulator for an elevator system. We asked the student to complete these steps and to implement their design in C++. For C++ How to Program: Third Edition, we have completely remodeled this case study. At the ends of Chapters 1 through 7 and the end of Chapter 9, we use the "Thinking About Objects" sections to present a carefully paced introduction to object-oriented design using the UML. The UML is now the most widely used graphical representation scheme for modeling object-oriented systems.The UML is a complex, feature-rich graphical language. In our "Thinking About Objects" sections, we present a concise, simplified subset of these features. We then use this subset to guide the reader through a first design experience with the UML intended for the novice object-oriented designer/programmer. We present this case study in a fully solved format. This is not an exercise; rather, it is an end-to-end learning experience that concludes with a detailed walkthrough of the C++ code.

In each of the first five chapters we concentrate on the "conventional" methodology of structured programming, because the objects we will build will be composed, in part, of structured-program pieces. We then end each chapter with a "Thinking About Objects" section in which we present an introduction to object orientation using the Unified Modeling Language (UML). Our goal in these "Thinking About Objects" sections is to help students develop an object-oriented way of thinking, so they can immediately put to use the object-oriented programming concepts that they begin learning in Chapter 6. In the first of these sections at the end of Chapter 1, we introduce basic concepts (i.e., "object think") and terminology (i.e., "object speak"). In the optional "Thinking About Objects" sections at the ends of Chapters 2 through 5 we consider more substantial issues as we attack a challenging problem with the techniques of object-oriented design (OOD). We analyze a typical problem statement that requires a system to be built, determine the objects needed to implement that system, determine the attributes the objects will need to have, determine the behaviors these objects will need to exhibit and specify how the objects will need to interact with one another to meet the system requirements. We do all this even before we discuss how to write object-oriented C++ programs. In the "Thinking About Objects" sections at the ends of Chapters 6, 7 and 9, we discuss a C++ implementation of the object-oriented system we designed in the earlier chapters.

This case study is significantly larger than any other project attempted in the book. We feel that the student gains significant experience by following this complete design and implementation process. This project forced us to incorporate topics that we do not discuss in any other section of the book, including object interaction, an in-depth discussion of handles, the philosophy of using references vs. pointers and the use of forward declarations to avoid the circular include problem. This case study will help prepare students for the kinds of substantial projects encountered in industry.

"Thinking About Objects" Sections
In Chapter 2, we begin the first phase of an object-oriented design (OOD) for the elevator simulator—identifying the classes needed to implement the simulator. We also introduce the UML use case, class and object diagrams and the concepts of associations, multiplicity, composition, roles and links.

In Chapter 3, we determine many of the class attributes needed to implement the elevator simulator. We also introduce the UML statechart and activity diagrams and the concepts of events and actions as they relate to these diagrams.

In Chapter 4, we determine many of the operations (behaviors) of the classes in the elevator simulation. We also introduce the UML sequence diagram and the concept of messages sent between objects.

In Chapter 5, we determine many of the collaborations (interactions between objects in the system) needed to implement the elevator system and represent these collaborations using the UML collaboration diagram. We also include a bibliography and a list of Internet and World Wide Web resources that contain the UML 1.3 specifications and other reference materials, general resources, tutorials, FAQs, articles, whitepapers and software.

In Chapter 6, we use the UML class diagram developed in previous sections to outline the C++ header files that define our classes. We also introduce the concept of handles to objects in the system and we begin to study how to implement handles in C++.

In Chapter 7, we present a complete elevator simulator C++ program (approximately 1000 lines of code) and a detailed code walkthrough. The code follows directly from the UML-based design created in previous sections and employs our good programming practices, including the use of static and const data members and functions. We also discuss dynamic-memory allocation, composition and object interaction via handles and how to use forward declarations to avoid the circular include problem.

In Chapter 9, we update the elevator simulation design and implementation to incorporate inheritance. We also suggest further modifications so that the student may then design and implement, using the tools presented in the previous sections.

We sincerely hope that this newly updated elevator simulation case study provides a challenging and meaningful experience for both students and instructors. We employ a carefully developed, incremental object-oriented process to produce a UML-based design for our elevator simulator. From this design, we produce a substantial working C++ implementation using key programming notions, including classes, objects, encapsulation, visibility, composition and inheritance. We would be most grateful if you would take a moment to send your comments, criticisms and suggestions for improving this case study to us at deitel@deitel.com.

About this Book

C++ How to Program contains a rich collection of examples, exercises and projects drawn from many fields to provide the student with a chance to solve interesting real-world problems. The book concentrates on the principles of good software engineering and stresses program clarity. We avoid arcane terminology and syntax specifications in favor of teaching by example.

This book is written by educators who spend most of their time teaching and writing about edge-of-the-practice programming languages.

The text places a strong emphasis on pedagogy. For example, virtually every new concept of either C++ or object-oriented programming is presented in the context of a complete, working C++ program immediately followed by a window showing the program's output. Reading these programs is much like entering and running them on a computer. We call this our "live-code approach."

Among the other pedagogical devices in the text are a set of Objectives and an Outline at the beginning of every chapter; Common Programming Errors, Good Programming Practices, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips enumerated in, and summarized at, the end of each chapter; comprehensive bullet-list-style Summary and alphabetized Terminology sections in each chapter; Self-Review Exercises and Answers in each chapter; and the richest collection of Exercises in any C++ book.

The exercises range from simple recall questions to lengthy programming problems to major projects. Instructors requiring substantial term projects will find many appropriate problems listed in the exercises for Chapters 3 through 21. We have put a great deal of effort into the exercises to enhance the value of this course for the student.

In writing this book, we have used a variety of C++ compilers. For the most part, the programs in the text will work on all ANSI/ISO compilers.

This text is based on the C++ programming language as developed by Accredited Standards Committee X3, Information Technology and its Technical Committee X3J16, Programming Language C++, respectively. This language was approved by the International Standards Organization (ISO). For further details, contact:

X3 Secretariat
1250 Eye Street NW
Washington DC 20005

The serious programmer should read these documents carefully and reference them regularly. These documents are not tutorials. Rather they define C++ and C with the extraordinary level of precision that compiler implementors and "heavy-duty" developers demand.

We have carefully audited our presentation against these documents. Our book is intended to be used at the introductory and intermediate levels. We have not attempted to cover every feature discussed in these comprehensive documents.

Objectives
Each chapter begins with a statement of objectives. This tells the student what to expect and gives the student an opportunity, after reading the chapter, to determine if he or she has met these objectives. It is a confidence builder and a source of positive reinforcement.

Quotations
The learning objectives are followed by a series of quotations. Some are humorous, some are philosophical and some offer interesting insights. Our students enjoy relating the quotations to the chapter material. You may appreciate some of the quotations more after reading the chapters.

Outline
The chapter outline helps the student approach the material in top-down fashion. This, too, helps students anticipate what is to come and set a comfortable and effective learning pace.

Sections
Each chapter is organized into small sections that address key C++ topics.

13,741 Lines of Syntax-Colored Code in 268 Example Programs (with Program Outputs)
We present C++ features in the context of complete, working C++ programs; each program is immediately followed by a window containing the outputs produced when the program is run—we call this our "live-code approach." This enables the student to confirm that the programs run as expected. Relating outputs back to the program statements that produce those outputs is an excellent way to learn and to reinforce concepts. Our programs exercise the diverse features of C++. Reading the book carefully is much like entering and running these programs on a computer. The code is "syntax colored" with C++ keywords, comments and other program text each appearing in different colors. This makes it much easier to read the code—students will especially appreciate the syntax coloring when they read the many more substantial programs we present.

469 Illustrations/Figures
An abundance of colorized charts and line drawings is included. The discussion of control structures in Chapter 2 features carefully drawn flowcharts. (Note: We do not teach the use of flowcharting as a program development tool, but we do use a brief flowchart-oriented presentation to specify the precise operation of C++'s control structures.) Chapter 15, "Data Structures," uses colorized line drawings to illustrate the creation and maintenance of linked lists, queues, stacks and binary trees. The remainder of the book is abundantly illustrated.,

625 Programming Tips We have included six design elements to help students focus on important aspects of program development, testing and debugging, performance and portability. We highlight hundreds of these tips in the form of Good Programming Practices, Common Programming Errors, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips. These tips and practices represent the best we have been able to glean from almost six decades (combined) of programming and teaching experience. One of our students—a mathematics major—told us recently that she feels this approach is somewhat like the highlighting of axioms, theorems and corollaries in mathematics books; it provides a basis on which to build good software.

112 Good Programming Practices:Good Programming Practices are highlighted in the text. They call the student's attention to techniques that help produce better programs. When we teach introductory courses to nonprogrammers, we state that the "buzzword" of each course is "clarity," and we tell the students that we will highlight (in these Good Programming Practices) techniques for writing programs that are clearer, more understandable and more maintainable.

216 Common Programming Errors: Students learning a language—especially in their first programming course—tend to make certain kinds of errors frequently. Focusing on these Common Programming Errors helps students avoid making the same errors. It also helps reduce long lines outside instructors' offices during office hours!

87 Performance Tips: In our experience, teaching students to write clear and understandable programs is by far the most important goal for a first programming course. But students want to write the programs that run the fastest, use the least memory, require the smallest number of keystrokes, or dazzle in other nifty ways. Students really care about performance. They want to know what they can do to "turbo charge" their programs. So we have include Performance Tips to highlight opportunities for improving program performance.

37 Portability Tips: Software development is a complex and expensive activity. Organizations that develop software must often produce versions customized to a variety of computers and operating systems. So there is a strong emphasis today on portability, i.e., on producing software that will run on a variety of computer systems with few, if any, changes. Many people tout C++ as an appropriate language for developing portable software, especially because of C++'s close relationship to ANSI/ISO C and the fact that ANSI/ISO C++ is the global C++ standard. Some people assume that if they implement an application in C++, the application will automatically be portable. This is simply not the case. Achieving portability requires careful and cautious design. There are many pitfalls. We include numerous Portability Tips to help students write portable code.

146 Software Engineering Observations: The object-oriented programming paradigm requires a complete rethinking about the way we build software systems. C++ is an effective language for performing good software engineering. The Software Engineering Observations highlight techniques, architectural issues and design issues, etc. that affect the architecture and construction of software systems, especially large-scale systems. Much of what the student learns here will be useful in upper-level courses and in industry as the Student begins to work with large, complex real-world systems.

27 Testing and Debugging Tips: This "tip type" may be misnamed. When we decided to incorporate Testing and Debugging Tips into this new edition, we thought these tips would be suggestions for testing programs to expose bugs and suggestions for removing those bugs. In fact, most of these tips tend to be observations about capabilities and features of C++ that prevent bugs from getting into programs in the first place.

Summary
Each chapter ends with additional pedagogical devices. We present an extensive, bulletlist-style Summary in every chapter. This helps the student review and reinforce key concepts. There is an average of 37 summary bullets per chapter.

Terminology
We include a Terminology section with an alphabetized list of the important terms defined in the chapter—again, further reinforcement. There is an average of 72 terms per chapter.

Summary of Tips, Practices and Errors
We collect and list from the chapter the Good Programming Practices, Common Programming Errors, Performance Tips, Portability Tips, Software Engineering Observations and Testing and Debugging Tips.

554 Self-Review Exercises and Answers (Count Includes Separate Parts)
Extensive Self-Review Exercises and Answers to Self-Review Exercises are included for self study. This gives the student a chance to build confidence with the material and prepare to attempt the regular exercises.

877 Exercises (Count Includes Separate Parts; 1431 Total Exercises)
Each chapter concludes with a substantial set of exercises including simple recall of important terminology and concepts; writing individual C++ statements; writing small portions of C++ functions and classes; writing complete C++ functions, classes and programs; and writing major term projects. The large number of exercises enables instructors to tailor their courses to the unique needs of their audiences and to vary course assignments each semester. Instructors can use these exercises to form homework assignments, short quizzes and major examinations.

550 page Instructor's Manual with Solutions to the Exercises
The solutions for the exercises are included on the Instructor's CD and on the disks available only to instructors through their Prentice Hall representatives. NOTE: Please do not write to us requesting the instructor's CD. Distribution of this CD is limited strictly to college professors teaching from the book. Instructors may obtain the solutions manual only from their Prentice Hall representatives. Solutions to approximately half of the exercises are included on the C++ Multimedia Cyber Classroom: Third Edition CD (available September 2000; please see the last few pages of this book for ordering instructions).

4523 Index Entries (Total of 7653 Counting Multiple References)
We have included an extensive Index at the back of the book. This helps the student find any term or concept by keyword. The Index is useful to people reading the book for the first time and is especially useful to practicing programmers who use the book as a reference. Most of the terms in the Terminology sections appear in the Index (along with many more index items from each chapter). Thus, the student can use the Index in conjunction with the Terminology sections to be sure he or she has covered the key material of each chapter.

Your Rating:

Your Recommendations:

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked,
or didn't, with others. By submitting an online review, you are representing to
Barnes & Noble.com that all information contained in your review is original
and accurate in all respects, and that the submission of such content by you
and the posting of such content by Barnes & Noble.com does not and will not
violate the rights of any third party. Please follow the rules below to help
ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer.
However, we cannot allow persons under the age of 13 to have accounts at BN.com or
to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the
information on the product page, please send us an email.

Reminder:

- By submitting a review, you grant to Barnes & Noble.com and its
sublicensees the royalty-free, perpetual, irrevocable right and license to use the
review in accordance with the Barnes & Noble.com Terms of Use.

- Barnes & Noble.com reserves the right not to post any review -- particularly
those that do not follow the terms and conditions of these Rules. Barnes & Noble.com
also reserves the right to remove any review at any time without notice.

You have successfully created your Pen Name. Start enjoying the benefits of the BN.com Community today.

Sort by:
Showing
all of
5
Customer Reviews

Anonymous

Posted October 27, 2007

C++ HOW TO PROGRAM by Deitel

This book is ok but not great, my one reason is because they focus too much on one example program called GradeBook. I think had they put more smaller and more diversified example programs in then this book would then become a much better book. So to me it is ok as it is, but I suppose you could do worse also.

Was this review helpful? YesNoThank you for your feedback.Report this reviewThank you, this review has been flagged.

Anonymous

Posted September 16, 2007

Outstanding Book

Outstanding Book

Was this review helpful? YesNoThank you for your feedback.Report this reviewThank you, this review has been flagged.

Anonymous

Posted May 1, 2006

Absolutely the Best Progamming Series!!

I'm Currently using this book to teach myself programming early on as I just started College, and wanted to get a head start. I did an extensive search at an attempt find a solid series of text books that would prove suitable for my career programming needs now and in the future. The Deitel & Associates series text books not only did that...but went up and over the bar! This text proved to be very comprehensive, fun, and Rich in illustrations and diagrams. C++ How to program contains and utilizes: -Clear and concise writing stressing program clarity, extremely well structured paragraphs and main ideas -Cyber Class Room Access Card (new), grants access to your entire text online with features like Quizzes, Highliting, labs,and many more features! -Live Code Approach, an ingenious method of teaching that uses programming languages to teach programming languages -CDROM that includes the source code for all of the books examples and links to free compilers, tools, resources and much more!! -Option to suscribe to the deitel Newsletter and access to valuable info on thier Website. This is only the tip of the iceburg ladies and gents. This book has cemented the principles of programming and helped me build my foundation for my career. An Absolute must for any beginner!!

Was this review helpful? YesNoThank you for your feedback.Report this reviewThank you, this review has been flagged.

Anonymous

Posted September 1, 2005

Learning c++ fun?

We are moving from Delphi to C++, i picked up several books and courses, but this one (by the way here in Europe we do have the fifth edition...) made C++ clear and easy to understand. It kickstarted us developing in c++. Next to C++ they also give a good insight in software developing, UML tools and a deep explanation why things are done in a particulair way. So the book is not simple a list of all the possibilities with C++, but alsos give background on development en programming, something missing in most publications. I can advise it to all stepping into C++, it's worth every Euro i paid for it and all the sleep it has costed me.

Was this review helpful? YesNoThank you for your feedback.Report this reviewThank you, this review has been flagged.

Anonymous

Posted April 19, 2005

A well written and easily understood C++ book.

If you are like me you have probably tried to learn C++ in the past. I ended up buying a couple of the 'Learn C++ in X amount of days/hours' and was left with huge holes in my C++ education. I had vague ideas of how programs worked, but no understanding of the fundamentals of Object Oriented Programming. From the beginning of this book I was introduced to the ideas and concepts that are so integral to the understanding of this complex language. The exercises at the end of each chapter help me cement the concepts I learned into memory, and build a toolbox of problem solving methods that I am sure to use later on. As an added bonus the book has an optional case study at the end of each chapter which goes over UML 2.0. This was a very nice feature as it shows how an OOP approach really does save time when translating your design into code. I am very impressed with the way the information was presented, and the use of many different examples to illustrate a concept. This was my first Deitel & Deitel computer book, and I am quite pleased.

Was this review helpful? YesNoThank you for your feedback.Report this reviewThank you, this review has been flagged.