Sorting an array in C++