Here is my maddening c++ code.