this is my C++ primer solution