Many of the examples in C++ in a Nutshell are complete, compilable programs. Others are abbreviated versions of complete programs. A few are fragments that illustrate a specific point. This web site has links to all the complete programs, including complete versions of the abbreviated examples.
Download archives of all the examples:
cpp-nut-examples.tar.gz (UNIX line endings, 44K)
cpp-nut-examples.zip (DOS/Windows line endings, 88K)
Table of all example programs, with a brief description of each one, and an indication of which compilers can handle the program correctly.
Please note that these examples are designed to illustrate specific features of C++. Thus, they were designed for simplicity, not for robustness, portability, or performance. If you need code, such as a singly-linked list or rational numbers, for a real project, I suggest using Boost or similar library that is designed for that purpose.
All the examples have been tested on several different compilers on Linux and Microsoft Windows. Due to compiler and library bugs, however, not all examples work with every compiler. I have done my best to make every program work correctly, without sacrificing the intent of the example. I used the following compilers:
Linux:
Comeau Computing 4.3.0.1 with Dinkumware 4.02 library (como)
Borland Kylix 3.0 (kylix)
Intel 7.0 (icc)
g++ 3.3 (gcc)
Windows:
Borland C++ Builder 6.0 Update 4 (bcc)
Microsoft Visual C++ .NET 2003 (msc)
Metrowerks Code Warrior 8.3 (mwcc)