c++ codes for walking