Lathe C++ Code