Rather than having free-floating functions in the global namespace it would be better to create a
class that owns its data, encapsulating it from external access and then has accessor functions returning its attributes (e.g., radius).
An insertion operator (i.e.,
) that takes an instance of
, implemented in terms of a print member function on
could then dictate the format of its output in a localised way.
should then only include a header for your new
class and its
and a header containing your numerical constants (libraries like boost have these already if your curious http://www.boost.org/doc/libs/1_46_0/libs/math/doc/sf_and_dist/html/math_toolkit/toolkit/internals1/constants.html).
Try to encapsulate the contents of both headers in their own namespaces, e.g.,
and refer to them outside of it as via a scope specification operator e.g.,