I am trying to figure out how to reverse for example,grades{1, 2, 3, 4, 5, 6}
starting at the third element.
I know for lists we cannot do (grades.begin() + 2)
to obtain the position, but I'm not sure how to go about it. This is what I have so far, where I'm just reversing the entire list:
reverse(firstList.begin(), firstList.end());
I want it to be reverse so that the list becomes: grades{1, 2, 6, 5, 4, 3}
Aucun commentaire:
Enregistrer un commentaire