A C++ header file conventionally has suffix .h, as in myheader.h. To use this custom header, put a line #include "myheader.h" in your source file.
User definitions can be easily and robustly implemented with ``inline functions''. Inline functions are superficially similar to macros, but are far more safe and featureful (since they are handled by the compiler rather than by the pre-processor). Examples are
inline void Bold(void) { pen(1.5); } inline void purple(void) { rgb(0.5, 0, 0.7); } inline void draw_square(double s) { rect(P(-s,-s),P(s,s)); } inline double cube(double x) { return x*x*x; }The keyword void signifies a function that does not return a value, or (when used as a parameter) a function that does not accept arguments. Inline function definitions are syntactically exactly like ordinary function definitions, but must occur in a header file or in the source file where they are used. The examples above might be used in an input file as follows:
Bold(); draw_square(cube(1.25));