Problem Solving using C++