本书可作为高等院校相关专业的编程语言教材和C++编程教材，也是软件设计人员进行C++程序开发的宝贵参考资料。For Introduction to Programming (CS1) and other more intermediate courses covering programming in C++. Also appropriate as a supplement for upper-level courses where the instructor uses a book as a reference for the C++ language.
This best-selling comprehensive text is aimed at readers with little or no programming experience. It teaches programming by presenting the concepts in the context of full working programs and takes an early-objects approach. The authors emphasize achieving program clarity through structured and object-oriented programming, software reuse and component-oriented software construction. The Seventh Edition encourages students to connect computers to the community, using the Internet to solve problems and make a difference in our world. All content has been carefully fine-tuned in response to a team of distinguished academic and industry reviewers.
- “Making a Difference” Exercise Sets. We encourage you to use computers and the Internet to research and solve problems that really matter. These new exercises are meant to increase awareness of important issues the world is facing. We hope you’ll approach them with your own values, politics and beliefs.
- Prefer string Objects to C Strings. C++ offers two types of strings—string class objects (which we use starting in Chapter 3) and C-style, pointer-based strings. We continue to include some early discussions of C strings to give you practice with pointer manipulations, to illustrate dynamic memory allocation with new and delete and to prepare you for working with C strings in the “legacy code” that you’ll encounter in industry. In new development, you should favor string class objects. We’ve replaced most occurrences of C strings with instances of C++ class string to make programs more robust and eliminate many of the security problems that can be caused by manipulating C strings.
- Prefer vectors to C Arrays. Similarly, C++ offers two types of arrays—vector class objects (which we use starting in Chapter 7) and C-style, pointer-based arrays. As appropriate, we use class template vector instead of C arrays throughout the book. However, we begin by discussing C arrays in Chapter 7 to prepare you for working with legacy code and to use as a basis for building your own customized Array class in Chapter 11, Operator Overloading.
- New Companion Website (www.pearsonhighered.com/deitel/). This edition’s Companion Website includes a wealth of material to help you with your study of C++ programming. We provide an extensive number of VideoNotes that walk you through the code examples in 14 of the key chapters, solutions to many of the book’s exercises, bonus chapters, and more (see the Companion Website section later in this Preface).
- Dynamic Memory Allocation. We moved dynamic memory allocation later in the book to Chapter 11, where it’s first needed. The “proxy class” discussion (which uses dynamic memory) has also been moved to Chapter 11.
- Titled Programming Exercises. We’ve titled all the programming exercises. This and the previous two features help instructors tune assignments for their classes.
- Eliminated “Magic” Numbers. We eliminated all uses of truly “magic” numbers and replaced them with named constants or enums as appropriate. In a few cases in which the context is absolutely clear, we don’t consider numbers to be “magic.”
- Enhanced Use of const. We increased our use of const bookwide to encourage better software engineering.
- Eliminated “return 0;”. According to the C++ standard, any main function that does not contain “return 0;” as its last statement is assumed to return 0. For this reason, we’ve eliminated “return 0;” from all but the first program in the book.
- Use “using namespace std;”. Previously, we specified a using declaration for every individual item that we referenced from a C++ Standard Library header file. Since these items are well known and unlikely to have name collisions with other C++ libraries, we now use “using namespace std;” for all C++ Standard Library components from Chapter 3 forward. This simplifies the programs and saves many lines of code.
- New Design. The book has a new interior design that graphically serves to organize, clarify and highlight the information, and enhances the book’s pedagogy.
- Reorganized Optional OOD Case Study. We tuned the Object-Oriented Design/UML automated teller machine (ATM) case study and reorganized it into two optional chapters (25 and 26) that present the ATM’s design and complete code implementation. This is a nice business example that most students can relate to. Working through these two chapters as a unit will help you tie together many of the object-oriented programming (OOP) concepts you learn in Chapters 1–13. A key concept in OOP is the interactions among objects. In most textbooks, the code examples create and use only one or two objects. The ATM case study gives you the opportunity to examine the interactions among many objects that provide the functionality of a substantial system. For instructors who wish to cover the case study in a distributed manner, we’ve indicated where each section in Chapters 25 and 26 can be covered inline with earlier chapters in the book.
- Function Pointer Exercises. We added several real-world function-pointers exercises. These are available at the Companion Website and at www.deitel.com/books/cpphtp7/.
- Improved Terminology Sections. We’ve added page numbers for the defining occurrences of all terms in the terminology lists for easy reference.
- We discuss four new language features that will be part of the next C++ standard and are already implemented by some of today’s C++ compilers. These include:
- Initializer Lists for User-Defined Types. These enable objects of your own types to be initialized using the same syntax as built-in arrays.
- Range-Based for Statement. A version of the for statement that iterates over all the elements of an array or container (such as an object of the vector class).
- Lambda Expressions. These enable you to create anonymous functions that can be passed to other functions as arguments.
- Concepts. These enable template programmers to specify the requirements for data types that will be used with a particular template. Compilers can then provide more meaningful error messages when data types do not meet a template’srequirements.