viii PREFACE Dependency Chart The dependency chart on the next page shows possible orderings of chapters and subsections.A line joining two boxes means that the upper box must be covered before the lower box.Any ordering that is consistent with this partial ordering can be read without loss of continuity.If a box contains a section number or numbers,then the box refers only to those sections and not to the entire chapter. Summary Boxes Each major point is summarized in a boxed section.These boxed sections are spread throughout each chapter. Self-Test Exercises Each chapter contains numerous Self-Test Exercises at strategic points.Com- plete answers for all the Self-Test Exercises are given at the end of each chapter. VideoNotes VideoNotes are designed for teaching students key programming concepts and techniques.These short step-by-step videos demonstrate how to solve problems from design through coding.VideoNotes allow for self-paced instruction with easy navigation including the ability to select,play,rewind,fast-forward,and stop within each VideoNote exercise. Online Practice and Assessment with MyProgrammingLab MyProgrammingLab helps students fully grasp the logic,semantics,and syn- tax of programming.Through practice exercises and immediate,personalized feedback,MyProgrammingLab improves the programming competence of be- ginning students who often struggle with the basic concepts and paradigms of popular high-level programming languages. A self-study and homework tool,a MyProgrammingLab course consists of hundreds of small practice problems organized around the structure of this textbook.For students,the system automatically detects errors in the logic and syntax of their code submissions and offers targeted hints that enable students to figure out what went wrong-and why.For instructors,a comprehensive gradebook tracks correct and incorrect answers and stores the code inputted by students for review. MyProgrammingLab is offered to users of this book in partnership with Turing's Craft,the makers of the CodeLab interactive programming exer- cise system.For a full demonstration,to see feedback from instructors and students,or to get started using MyProgrammingLab in your course,visit www.myprogramminglab.com
viii Preface Dependency Chart The dependency chart on the next page shows possible orderings of chapters and subsections. A line joining two boxes means that the upper box must be covered before the lower box. Any ordering that is consistent with this partial ordering can be read without loss of continuity. If a box contains a section number or numbers, then the box refers only to those sections and not to the entire chapter. Summary Boxes Each major point is summarized in a boxed section. These boxed sections are spread throughout each chapter. Self-Test Exercises Each chapter contains numerous Self-Test Exercises at strategic points. Complete answers for all the Self-Test Exercises are given at the end of each chapter. VideoNotes VideoNotes are designed for teaching students key programming concepts and techniques. These short step-by-step videos demonstrate how to solve problems from design through coding. VideoNotes allow for self-paced instruction with easy navigation including the ability to select, play, rewind, fast-forward, and stop within each VideoNote exercise. Online Practice and Assessment with MyProgrammingLab MyProgrammingLab helps students fully grasp the logic, semantics, and syntax of programming. Through practice exercises and immediate, personalized feedback, MyProgrammingLab improves the programming competence of beginning students who often struggle with the basic concepts and paradigms of popular high-level programming languages. A self-study and homework tool, a MyProgrammingLab course consists of hundreds of small practice problems organized around the structure of this textbook. For students, the system automatically detects errors in the logic and syntax of their code submissions and offers targeted hints that enable students to figure out what went wrong—and why. For instructors, a comprehensive gradebook tracks correct and incorrect answers and stores the code inputted by students for review. MyProgrammingLab is offered to users of this book in partnership with Turing’s Craft, the makers of the CodeLab interactive programming exercise system. For a full demonstration, to see feedback from instructors and students, or to get started using MyProgrammingLab in your course, visit www.myprogramminglab.com. VideoNote
PREFACE iⅸ DISPLAY P.1 Dependency Chart Chapter 1 Chapter 2 Chapter 4 Chapter 5 Introduction C++Basics Functions 1 Functions 2 Chapter 3 More Flow Chapter 6 of Control I/O Streams Chapter 7 Arrays Chapter 14 Chapter 10 7.1-7.3 Recursion Classes 1 Chapter 7 7.4 Multi- Chapter 11 *Chapter 16 Classes 2 Dimensional Exception 11.1-11.2 Arrays Handling Chapter 8 Chapter 11 Chapter 12 Strings and 11.3 Classes Separate Vectors Arrays Compilation Namespaces Chapter 9 Chapter 11 Pointers and 11.4 Classes Chapter 13 Dynamic Dynamic Pointers and Arrays Linked Lists Arrays Chapter 15 Inheritance Chapter 17 Templates *Chapter 16 contains occasional references to derived classes, Chapter 18 but those references STL can be omitted
Preface ix DISPLAY P.1 Dependency Chart *Chapter 16 contains occasional references to derived classes, but those references can be omitted Chapter 1 Introduction Chapter 2 C++ Basics Chapter 3 More Flow of Control Chapter 6 I/O Streams Chapter 7 Arrays 7.1–7.3 Chapter 14 Recursion Chapter 10 Classes 1 Chapter 11 Classes 2 11.1–11.2 Chapter 7 7.4 MultiDimensional Arrays Chapter 15 Inheritance *Chapter 16 Exception Handling Chapter 12 Separate Compilation & Namespaces Chapter 11 11.3 Classes & Arrays Chapter 11 11.4 Classes & Dynamic Arrays Chapter 17 Templates Chapter 18 STL Chapter 9 Pointers and Dynamic Arrays Chapter 8 Strings and Vectors Chapter 13 Pointers and Linked Lists Chapter 4 Functions 1 Chapter 5 Functions 2
PREFACE Support Material There is support material available to all users of this book and additional material available only to qualified instructors. Materials Available to All Users of this Book Source Code from the book ■PowerPoint slides ■VideoNotes To access these materials,go to: www.pearsonhighered.com/savitch Resources Available to Qualified Instructors Only Visit Pearson Education's instructor resource center at www.pearsonhighered .com/irc to access the following instructor resources: Instructor's Resource Guide-including chapter-by-chapter teaching hints, quiz questions with solutions,and solutions to many programming projects Test Bank and Test Generator PowerPoint Lectures-including programs and art from the text ■Lab Manual Integrated Development Environment (IDE)Resource Kits Instructors who adopt this text can order it for students with a kit containing five popular C++IDEs(Microsoft Visual Studio 2013 Express Edition,Dev C++,NetBeans,Eclipse,and CodeLite)and access to a Web site containing written and video tutorials for getting started in each IDE.For ordering infor- mation,please contact your campus Pearson Education representative. Contact Us Your comments,suggestions,questions,and corrections are always welcome. Please e-mail them to savitch.programming.cpp@gmail.com Acknowledgments Numerous individuals and groups have provided me with suggestions,discus- sions,and other help in preparing this textbook.Much of the first edition of this book was written while I was visiting the Computer Science Department at the University of Colorado in Boulder.The remainder of the writing on the first edition and the work on subsequent editions was done in the Computer Science and Engineering Department at the University of California,San Diego (UCSD).I am grateful to these institutions for providing a conducive environ- ment for teaching this material and writing this book
x Preface Support Material There is support material available to all users of this book and additional material available only to qualified instructors. Materials Available to All Users of this Book ■ Source Code from the book ■ PowerPoint slides ■ VideoNotes To access these materials, go to: www.pearsonhighered.com/savitch Resources Available to Qualified Instructors Only Visit Pearson Education’s instructor resource center at www.pearsonhighered .com/irc to access the following instructor resources: ■ Instructor’s Resource Guide—including chapter-by-chapter teaching hints, quiz questions with solutions, and solutions to many programming projects ■ Test Bank and Test Generator ■ PowerPoint Lectures—including programs and art from the text ■ Lab Manual Integrated Development Environment (IDE) Resource Kits Instructors who adopt this text can order it for students with a kit containing five popular C++ IDEs (Microsoft® Visual Studio 2013 Express Edition, Dev C++, NetBeans, Eclipse, and CodeLite) and access to a Web site containing written and video tutorials for getting started in each IDE. For ordering information, please contact your campus Pearson Education representative. Contact Us Your comments, suggestions, questions, and corrections are always welcome. Please e-mail them to savitch.programming.cpp@gmail.com Acknowledgments Numerous individuals and groups have provided me with suggestions, discussions, and other help in preparing this textbook. Much of the first edition of this book was written while I was visiting the Computer Science Department at the University of Colorado in Boulder. The remainder of the writing on the first edition and the work on subsequent editions was done in the Computer Science and Engineering Department at the University of California, San Diego (UCSD). I am grateful to these institutions for providing a conducive environment for teaching this material and writing this book
PREFACE xi I extend a special thanks to all the individuals who have contributed critiques or programming projects for this or earlier editions and drafts of this book. In alphabetical order,they are:Alex Feldman,Amber Settle,Andrew Burt,Andrew Haas,Anne Marchant,Barney MacCabe,Bob Holloway,Bob Matthews,Brian R.King,Bruce Johnston,Carol Roberts,Charles Dowling,Claire Bono,Cynthia Martincic,David Feinstein,David Teague,Dennis Heckman,Donald Needham, Doug Cosman,Dung Nguyen,Edward Carr,Eitan M.Gurari,Ethan Munson, Firooz Khosraviyani,Frank Moore,Gilliean Lee,Huzefa Kagdi,James Stepleton, Jeff Roach,Jeffrey Watson,Jennifer Perkins,Jerry Weltman,Joe Faletti,Joel Cohen, John J.Westman,John Marsaglia,John Russo,Joseph Allen,Joseph D.Oldham, Jerrold Grossman,Jesse Morehouse,Karla Chaveau,Ken Rockwood,Larry Johnson, Len Garrett,Linda F.Wilson,Mal Gunasekera,Marianne Lepp,Matt Johnson, Michael Keenan,Michael Main,Michal Sramka,Naomi Shapiro,Nat Martin,Noah Aydin,Nisar Hundewale,Paul J.Kaiser,Paul Kube,Paulo Franca,Richard Borie, Scot Drysdale,Scott Strong,Sheila Foster,Steve Mahaney,Susanne Sherba,Thomas Judson,Walter A.Manrique,Wei Lian Chen,and Wojciech Komornicki. I extend a special thanks to the many instructors who used early editions of this book.Their comments provided some of the most helpful reviewing that the book received. Finally,I thank Kenrick Mock who implemented the changes in this edition.He had the almost impossible task of pleasing me,my editor,and his own sensibilities,and he did a superb job of it. Walter Savitch
Preface xi I extend a special thanks to all the individuals who have contributed critiques or programming projects for this or earlier editions and drafts of this book. In alphabetical order, they are: Alex Feldman, Amber Settle, Andrew Burt, Andrew Haas, Anne Marchant, Barney MacCabe, Bob Holloway, Bob Matthews, Brian R. King, Bruce Johnston, Carol Roberts, Charles Dowling, Claire Bono, Cynthia Martincic, David Feinstein, David Teague, Dennis Heckman, Donald Needham, Doug Cosman, Dung Nguyen, Edward Carr, Eitan M. Gurari, Ethan Munson, Firooz Khosraviyani, Frank Moore, Gilliean Lee, Huzefa Kagdi, James Stepleton, Jeff Roach, Jeffrey Watson, Jennifer Perkins, Jerry Weltman, Joe Faletti, Joel Cohen, John J. Westman, John Marsaglia, John Russo, Joseph Allen, Joseph D. Oldham, Jerrold Grossman, Jesse Morehouse, Karla Chaveau, Ken Rockwood, Larry Johnson, Len Garrett, Linda F. Wilson, Mal Gunasekera, Marianne Lepp, Matt Johnson, Michael Keenan, Michael Main, Michal Sramka, Naomi Shapiro, Nat Martin, Noah Aydin, Nisar Hundewale, Paul J. Kaiser, Paul Kube, Paulo Franca, Richard Borie, Scot Drysdale, Scott Strong, Sheila Foster, Steve Mahaney, Susanne Sherba, Thomas Judson, Walter A. Manrique, Wei Lian Chen, and Wojciech Komornicki. I extend a special thanks to the many instructors who used early editions of this book. Their comments provided some of the most helpful reviewing that the book received. Finally, I thank Kenrick Mock who implemented the changes in this edition. He had the almost impossible task of pleasing me, my editor, and his own sensibilities, and he did a superb job of it. Walter Savitch
BREAK THROUGH To improving results get with the programming Through the power of practice and immediate personalized feedback,MyProgrammingLab improves your performance. MyProgrammingLab Learn more at www.myprogramminglab.com ALWAYS LEARNING PEARSON
Through the power of practice and immediate personalized feedback, MyProgrammingLab improves your performance. Learn more at www.myprogramminglab.com get with the programming To improving results