Swap Elements in a list - Code Eval easy challenge - c++