Added c++ code creation for nearest neighbors