C++ Program Design: Third Edition

Jim Cohoon and Jack Davidson

  Important features
Laboratory materials
Lecture materials
Self-check solutions
Solution manual
Homework assignments



  • Early coverage of classes and objects. We believe that students must first be client users of objects before they can appreciate the difficulties of designing flexible, usable objects. All proficient designers started as users. We first use standard stream class objects, such as cout and cin, string objects using the Standard Template Library, and a limited number of objects derived from a graphical library developed for the textbook. This experience helps reinforce the concepts of encapsulation, software reuse, and the object-oriented programming paradigm.
  • Broad coverage of the adopted C++ standard. The coverage reflects the important additions and modifications to the language, such as the type bool, Standard Template Library, namespaces, and exceptions. Because we recognize that some compilers do not yet reflect the standard, aside boxes are used to highlight changes with the past and offer alternative implementations.
  • Integrated use of the Standard Template Library (STL). The STL with its rich collection of container classes for representing lists and strings and its generic algorithms is going to change the way programmers develop software. We extensively explore the string and vector classes.
  • Extensive coverage of classes. More than fifty classes are designed and developed.
  • Software engineering concepts are introduced using problems and software projects.   Real world examples are drawn from many varied areas such as science, business, engineering, humanities, mathematics, recreation, etc.
  • Testing and debugging. Detailed introduction on how to test and debug a program
  • We present the use of a graphical Application Programmer Interface (API) designed specifically for beginning programmers to develop interesting programs.  An API is provided on CDROM to support the software projects in the book. The API is a portable, object-oriented graphical library, named EzWindows, for the easy display of simple geometric, bitmap, and text objects. We supply implementations of the API for popular Windows and  UNIX compilers. The API allows students to easily design and implement exciting programs while learning the fundamentals of programming. The CDROM also provides most of the code presented in the book.
  • Friendly pedagogy, self-check exercises, and numerous homework exercises. The text also includes style tips, programming boxes, warning boxes, historical notes, and other guides to learning C++ and program design.  The exercises span the gamut of quick tests of fundamental concepts to short programming assignments to final projects.

Table of Contents

  • Chapter 1 -- Computing and the object-oriented design methodology:
    • Basic computing terminology, software, engineering software, object-oriented
  • Chapter 2 -- C++ Fundamentals:
    • A first program, program organization, a second program, comments, assigning a value, fundamental C++ objects, constants, names, definitions, expressions, output statements, computing average velocity
  • Chapter 3 -- Modifying objects:
    • Assignment, const definitions, input statements, computing the number of molecules in a hydrocarbon, compound assignment, increment and decrement, Estimating yearly savings of change, The string class, EzWindows, mowing lawns
  • Chapter 4 -- Control constructs:
    • Boolean algebra, Boolean type, if statement, switch statement, computing a requested expression, validating a date, while statement, simple string and character processing, for statement, simple data visualization, solving the lazy hobo riddle, iteration using the do construct
  • Chapter 5 -- Function usage basics and libraries:
    • Preprocessor, software libraries, iostream library, iomanip library, fstream library, random numbers, assert library
  • Chapter 6 -- Programmer-defined functions:
    • Basics, some useful functions, integrating a quadratic polynomial, local scope, global scope, reference parameters, validating telephone access codes, constant parameters, default parameters, casting of function parameters, function overloading, recursive functions, displaying a price-interval stock chart
  • Chapter 7 -- The class construct and object-oriented design:
    • Introducing a programmer-defined data type, RectangleShape class, using the RectangleShape class, constructors, building a kaleidoscope, object-oriented analysis, and design
  • Chapter 8 -- Implementing abstract data types:
    • Rational ADT basics, introducing abstract data types, rational interface description, implementing the rational class, copy construction, member assignment, and destruction, ADT for pseudorandom integers, Red-yellow-green game
  • Chapter 9 -- Lists:
    • One-dimensional arrays, named collections, arrays as parameters, sorting, container classes, class vector, QuickSort, binary searching, string class revisited, find that word, two-dimensional lists, maze runner, multidimensional arrays,
  • Chapter 10 -- The EzWindows API: a detailed examination:
    • Application programmer interfaces, a simple window class, bitmap class, mouse events, bitmaps and mouse events, timer events, alert messages, Simon says
  • Chapter 11 -- Pointers and dynamic memory:
    • Pointer basics, lvalues and rvalues, constant pointers and pointers to constants, arrays and pointers, character string processing, orogram command-line parameters, oointers to functions, dynamic objects, Simple ADT for representing lists of integer values
  • Chapter 12 -- Testing and Debugging:
    • Testing, debugging
  • Chapter 13 -- Inheritance:
    • Object-oriented design using inheritance, reuse via inheritance, hierarchy of shapes, protected members and inheritance, controlling inheritance, multiple inheritance, a prettier kaleidoscope
  • Chapter 14 -- Templates and polymorphism:
    • Function templates, generic actions and types, class templates, a simple list class using a class template, sequential lists, oolymorphism, virtual function nuances, abstract base classes, virtual multiple inheritance
  • Chapter 15 -- Software bug hunt!:
    • Base class Bug, Bug hunt, Class GameController, Bug hunt
  • Appendix A -- Tables:
    • ASCII character set; operator precedence
  • Appendix B -- Standard libraries:
    • Iostream library, library naming and access, math library, stdlib library, time library, cstring library, algorithm library
  • Appendix C -- Standard classes:
    • Container classes, class string
  • Appendix D -- Advanced topics:
    • Namespaces; exception handling; friends
  • Appendix E -- EzWindows API reference manual:
    • Coordinate system, Enumerated types, class Position, class SimpleWindow, class WindowObject, class RaySegment, class Shape, class EllipseShape, class CircleShape, class RectangleShape, class TriangleShape, class SquareShape, class Label, class BitMap, class RandomInt, miscellaneous functions
  • Appendix F -- Projects and makefiles:
    • Project and makefile fundamentals, Borland C++ IDE, Microsoft Visual C++ IDE, UNIX makefiles