Exercise for C++ Primer 5th.