What do I need to know before studying this lesson?
You should have a knowledge of vectors and vector iterators

What does rotate do?
Rotate will shift the values of a vector to the left or right. Example output:

Quote

before rotation: 1 2 3 4 5 6 7 8 9
after rotation: 6 7 8 9 1 2 3 4 5

Before we get started, here is the general syntax for the rotate function:rotate (<vector position to start>, <how many values to shift across>, <where to end>);DON'T BE INTIMIDATED BY THIS, IT REALLY IS SIMPLE!

So how do we start?
What do we need to include? Well, we need a vector, an algorithm and some I/O (to see what's going on) So:

#include <iostream>
#include <algorithm>
#include <vector>

Now, what are we going to use from the std namespace? We need:

using std::cout; // output the values to see what's happening
using std::endl; // make our output easier to read
using std::cin; // pause for input
using std::vector; // and of course, we need a vector

Replies To: Using the STL algorithm::rotate()

This tutorial has been approved, as the information is factually correct. This, with other submissions, however, are really examples of some of the basic features of the algorithm header. Perhaps a more encompassing tutorials grouping several methods together might be beneficial.