chapter 8 exercise 8-1: rewrite group_analysis function as a template function

I can call this template version of group_analysis directly by
specifying a grade function (such as grade_aux) as  type type parameter.
For example:
cout<<group_analysis<grade_aux>(did);

However, I could not pass a function as type parameter if that function
is a parameter itself, that is why I have to rewrite the write_analysis
function as a template function: a type parameter in a function can be
used as the type argument of another template function