The C++ compiler ordinarily requires C++ programs to be
ordered such that each function's
definition appears before calls to that function appear. Thus,
box_car_volume
must be defined before main
is defined,
because main
contains a call to box_car_volume
.
The reason for requiring programs to be so ordered is that such ordering simplifies the development of efficient compilers.
Later, in the hardcopy version of this book, you learn that function prototypes make it possible to write programs in which function calls do appear before definitions. Until then, be sure each function's definition appears before calls to that function appear.