Sorting program in C++