C++ Homework Problem Set 2 solutions