did Simple Sorting puzzle in C++