Lockheed Martin interview question

Use C++ to solve a given problem.