C++ How to Program Ex: 3.12