simple c++ code on KNN