Problem Solving with C++ door