Yes, you just forgot to pass by reference for rotateList.
1 2 3 4 5
// New prototype
void rotateList (vector<int> &list); // <-- You didn't have the &
// New function def
void rotateList (vector<int> &list) // <-- You didn't have the &
That's it.
You need to pass by ref. such that the modifications you made to list in the rotateList function are done to the data vector. Without the & you just rotated a local copy of data and that is why you didn't see the correct output when you printed in the main().
That's the thing, 25 0 1 4 9 16 is what outputs with that code up there ^ but the thing is, only 25 is moved to the front. Our teacher wants us to make our code so that the output ends up being 25 16 9 4 1 0 but I'm just stuck now, completely confused.
Honestly, it sounds like your instructor screwed up on the output requirements. rotateList does exactly what one would expect it to do (although it might be useful to be able to specifiy a direction,) but supplying a reverseList isn't difficult.
Set an index beg to 0. Set another index end to MAX-1. Then:
1 2 3 4 5
whilebeg < end
{
swap the elements at those indexes
increment beg and decrement end.
}