Gnome sort in c++