Lecture 6 - Slide 40 : 40
More compile time computations - older stuff
We show examples of simple recursive functions which can be called and evaluated by the compiler
fak1.cpp
The factorial function - from Wikipedia.
pow1.cpp
The power function on integer type arguments.
pow1a.cpp
The power function on integer type arguments - alternative implementation with an enumeration constant.
pow3.cpp
A more advanced version of the power function - from Stack Overflow.
pow4.cpp
A variant of the more advanced version of the power function.
pow3-output
Program output - both versions.

The 'functions' from above relies on the compiler's ability to evaluate constant expressions, see §C.5 in The C++ Prog. Lang. (3. edition)