Updated C++ Selection Sort algorithm