C++ Primer 5th Edition Exercise