Rather than having free-floating functions in the global namespace it would be better to create a
Circle
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.,
operator<<
) that takes an instance of
Circle
, implemented in terms of a print member function on
Circle
could then dictate the format of its output in a localised way.
should then only include a header for your new
Circle
class and its
operator<<
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.,
namespace geometry
and refer to them outside of it as via a scope specification operator e.g.,
geometry::Circle
.