Shifting a string of characters?
<p>I'm writing a program that solves Caesar ciphers in C++. It takes a string of the alphabet and shifts it to the left each loop: "abc....yz" --> "bcd.....yza". The problem is after another loop it goes: "bcd.....yza" --> "cde.....yzaa".</p>

<pre><code>char temp;       // holds the first character of string
string letters = "abcdefghijklmnopqrstuvwxyz";
while (true)
{
    temp = letters[0];
    for (int i = 0; i &lt; 26; i++)
    {
        if (i == 25)
        {
            letters += temp;
        }
        letters[i] = letters[i + 1];
        cout &lt;&lt; letters[i];
    }
    cin.get();
}
</code></pre>

<p>Copy and paste that code and you'll see what I'm talking about. How do I fix this mysterious problem?</p>
