Preface - Hands On C++

There is an old Chinese proverb that reads:

   I hear and I forget,
   I see and I remember,
   I do and I understand.
The proverb points out that human learning (or understanding) is best accomplished as an active, hands-on process involving a variety of our senses. In recognition of this, computing has increasingly become a laboratory discipline, in which dry, abstract lectures are being replaced by hands-on laboratory experiences. By doing so, the passive listeners of a lecture are replaced by active participants in a laboratory experiment. Learning occurs by doing.

This book provides a set of exercises for a laboratory course in which students are introduced to computer programming using the language C++. Unlike most books on C++, no previous programming experience is assumed.

Thanks to the ability to hyperlink common materials, we will be creating versions of this manual for these platforms:

New In This Edition

In addition to support for new implementations of C++, this second edition of Hands On C++ introduces several other changes to the manual:


As hinted at above, this manual uses the introduce, use, build 'spiral' approach. Topics like functions, control structures and classes are introduced early, used until they become familiar, and then built. Within this framework, the central ideas of object-oriented programming are introduced gradually, as appropriate to the problems being solved. By the end of the manual, the focus is almost solely on classes and object-oriented techniques. Each exercise consists of three parts:
  1. A pre-lab question list. Each laboratory exercise introduces new topics and concepts. If a student arrives at a closed lab session unfamiliar with the day's material, then s/he will waste a significant amount of time becoming familiar with that material. To prevent this from occurring, the first link on each exercise consists of a page of five simple questions, whose answers appear in the lab exercise. By requiring their students to answer (and turn in) these questions in order to be admitted to a lab session, instructors can ensure that students have read the exercise before-hand. This in turn will ensure that the students' lab time is spent using the machines, rather then reading.
  2. The laboratory exercise. This portion of the exercise is to be done in a closed lab, with an instructor and/or TA available for help if you become stuck.
  3. Programming projects. Four programming projects (of varying difficulty levels) are provided with each lab. An instructor can assign a project of the appropriate difficulty level to be completed outside of the closed laboratory session. A project grade sheet is provided with suggested point values, to simplify project evaluation.
The laboratory exercises can be done individually or collaboratively (though each student should get hands-on experience). The pre-lab exercises and projects are intended to be done individually.

Pedagogical Issues

In keeping with recommendations made at the 1994 SIGCSE workshop on Implementing Closed Labs, the exercises incorporate a number of pedagogical features. These include: A total of thirteen exercises are provided.

We would be remiss if we neglected to mention that C++ is a huge language. As a simple measure of its size, consider that its parent language C has 32 keywords, while C++ has 48 keywords: a 50% increase! The exercises in this book are intended to introduce novice programmers to C++, not explore the language exhaustively. By the time a student completes the exercises in this book, s/he should be capable of reading and understanding any of the many books that provide comprehensive coverage of the C++ language. Advanced topics such as exception handling, pure virtual functions and abstract base classes are not covered in this manual, and are left for the student to explore once they have firmly grasped the fundamentals.

Code Distribution

The C++ files for these exercises are now provided as a "built-in" part of each exercise, accessed via a hyperlink. There is thus no need to ftp or uncompress these files.

If you wish to avoid network congestion, you may wish to review the lab exercise ahead of time, and download any source files it uses for your students.


Because everyone is human, feedback is encouraged on those exercises (or parts of exercises) that are particularly effective, and those that need modification. Positive and negative comments can be directed to the author at the following U.S. mail address:
   Joel Adams
   Department of Computer Science
   Calvin College
   Grand Rapids, MI 49546


Thanks to the many students who suffered through preliminary versions of these exercises. Special thanks go to my wife Barbara whose faith, hope and love keep me going. Finally, thanks to God the Father, Son and Holy Spirit who sustains me daily.

Back to the Title Page

Copyright 1998 by Joel C. Adams. All rights reserved.