Solving problems with C++