C++ Train program