Using sorting algorithms in C++