Template again

Dear all,

The only reason I posted the whole code was to give one the chance to run the program and see in practice the problem.
But I guess you are right, that is too much.
Anyway,
The implementation of the two functions is: