high school c++ code solution.