You can in fact put a group of functions in a file. This is useful if you
want to work with a group of functions as modules. To include this file, we
need to place this header (.h) file ins the same direcotyr where our source
code (.cpp) is located. Or, we can just add it as part of our project (via
VS). When you include your own header files, be sure to use quotes instead
of arrows. Also, it is perfectly possible to use two separate files - one to
store function signatures for your functions and another for spelling your
function body. We'll examine this one in more detail later.
Also, as a courtesy for others and as an added style, try putting comments
about your function before you write it i.e. above the actual function body.
That way you would know what your function does, what the arguments should
be and what values to return or pass back to the program which calls your
function.
I think that's enough for now. When I arrive at UCR, I'll start by writing
my experiences with functions, as well as the reason why I mention functions
and vectors together.
// JL
No comments:
Post a Comment