So what is a function? It is simply a self-contained piece of program with certain inputs and outputs. When a function is activated it is said to be called. Functions can call other functions, so in effect a complex job can broken into progressively smaller, simpler ones. This principle is called stepwise refinement.
If you have been following the example used so far, you may have noticed functions being introduced without much comment. For example, in welcome2.cpp, a trivial procedure was divided into two even more trivial functions. Before starting a description of how to define more useful functions, we will have a look at some of the built-in functions provided in the 'standard library'.
©1994-2003 Kevin Boone, all rights reserved