From Control Structures through Objects
Tony Gaddis

#C++
#STL
Starting Out with C++: From Control Structures through Objects covers control structures, functions, arrays, and pointers before objects and classes in Tony Gaddis’s hallmark accessible, step-by-step presentation. His books help beginning students understand the important details necessary to become skilled programmers at an introductory level.
Gaddis motivates the study of both programming skills and the C++ programming language by presenting all the details needed to understand the “how” and the “why”–but never losing sight of the fact that most beginners struggle with this material.
Welcome to Starting Out with C++: From Control Structures through Objects, 9th edition. This book is intended for use in a two-semester C++ programming sequence, or an accelerated one-semester course. Students new to programming, as well as those with prior course work in other languages, will find this text beneficial. The fundamentals of programming are covered for the novice, while the details, pitfalls, and nuances of the C++ language are explored in depth for both the beginner and more experienced student. The book is written with clear, easy-to-understand language, and it covers all the necessary topics for an introductory programming course. This text is rich in example programs that are concise, practical, and real-world oriented, ensuring that the student not only learns how to implement the features and constructs of C++, but why and when to use them.
Changes in the Ninth Edition
This book’s pedagogy, organization, and clear writing style remain the same as in the previous edition. Many improvements and updates have been made, which are summarized here:
• The material on the Standard Template Library (STL) has been completely rewritten and expanded into its own chapter. Previously, Chapter 16 covered exceptions, templates, and gave brief coverage to the STL. In this edition, Chapter 16 covers exceptions and templates, and Chapter 17 is a new chapter dedicated to the STL. The new chapter covers the following topics:
❍ The array and vector classes
❍ The various types of iterators
❍ Emplacement versus insertion
❍ The map, multimap, and unordered_map Classes
❍ The set, multiset, and unordered_set Classes
❍ Sorting and searching algorithms
❍ Permutation algorithms
❍ Set algorithms
❍ Using function pointers with STL algorithms
❍ Function objects, or functors
❍ Lambda expressions
• Chapter 2 now includes a discussion of alternative forms of variable initialization, including functional notation, and brace notation (also known as uniform initialization).
• Chapter 3 now mentions the round function, introduced in C++ 11.
• Chapter 7 now introduces array initialization much earlier.
• In Chapter 8, the bubble sort algorithm has been rewritten and improved.
• A new example of sorting and searching a vector of strings has been added to Chapter 8.
• In Chapter 9, the section on smart pointers now gives an overview of shared_ptrs and weak_ptrs, in addition to the existing coverage of unique_ptrs.
• In Chapter 10, a new In the Spotlight section on string tokenizing has been added.
• Chapter 10 now covers the string-to-number conversion functions that were introduced in C++ 11.
• The material on unions that previously appeared in Chapter 11 has been moved to Appendix K, available on the book’s companion Website.
• Chapter 13 has new sections covering:
❍ Member initialization lists.
❍ In-place initialization.
❍ Constructor delegation.
• Several new topics were added to Chapter 14, including:
❍ Rvalue references and move semantics.
❍ Checking for self-assignment when overloading the = operator.
❍ Using member initialization lists in aggregate classes.
• Chapter 15 includes a new section on constructor inheritance.
• Several new programming problems have been added throughout the book.
Organization of the Text
This text teaches C++ in a step-by-step fashion. Each chapter covers a major set of topics and builds knowledge as the student progresses through the book. Although the chapters can be easily taught in their existing sequence, some flexibility is provided. The diagram shown in Figure P-1 suggests possible sequences of instruction.
Chapter 1 covers fundamental hardware, software, and programming concepts. You may choose to skip this chapter if the class is already familiar with those topics. Chapters 2 through 7 cover basic C++ syntax, data types, expressions, selection structures, repetition structures, functions, and arrays. Each of these chapters builds on the previous chapter and should be covered in the order presented.
After Chapter 7 has been covered, you may proceed to Chapter 8, or jump to Chapter 9.
After Chapter 9 has been covered, Chapter 10, 11, 12, or 13 may be covered. (If you jump to Chapter 12 at this point, you will need to postpone Sections 12.8, 12.9, and 12.10 until Chapter 11 has been covered.) After Chapter 13, you may cover Chapters 14 through 18 in sequence. Next, you can proceed to either Chapter 19 or Chapter 20. Finally, Chapter 21 may be covered.
This text’s approach starts with a firm foundation in structured, procedural programming before delving fully into object-oriented programming and advanced data structures.









