[c++] Finding the position of the max element