Create ex3_21_generics_version

To replace ex3_21.cpp 
This one is generics version using template, for general version please check @pezy's code.