C++ Beginner - While loop repeating first iteration : <p>All,</p>

<p>So I've been really racking my brain about this one. I have a section of my program that needs to count spaces/vowels/characters in a user-specified string. This is one of those "teach you the way no one would do it because you can only used what we've covered in class already" kinds of assignments. So I have the user input a text, ending with a sentinel char, which in this case is '#'. The loop works wonderfully in regards to exiting when the sentinel is encountered, but it keeps iterating twice over string[0]. Here's the code: </p>

<pre><code>i = 0;
characterToBeProcessed = userInputText.at(i);

while (characterToBeProcessed != LOOP_SENTINEL)
{
    fout &lt;&lt; characterToBeProcessed;

    // Convert to lowercase
    characterToBeProcessed = 
        static_cast&lt;char&gt; (tolower(characterToBeProcessed)); 

    // Increment character counters
    switch (characterToBeProcessed)
    {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
            totalVowelCount++;
            totalCharacterCount++;
            break;
        case ' ':
            totalSpaceCount++;
            totalCharacterCount++;
            break;
        default:
            totalCharacterCount++;
            break;
    }
    characterToBeProcessed = userInputText.at(i++);
}
</code></pre>

<p>So when I input at the prompt: </p>

<pre><code>"Please input a text to be analyzed, ending with the # character: "

 Hi there, my friend!#
</code></pre>

<p>The output is: </p>

<pre><code>Below is the text entered by the user: 

HHi there, my friend!

Total characters: 21
Total vowels: 5
Total blank spaces: 3
</code></pre>

<p>I've had the program output the chars for .at(0) and .at(1), and those give me the correct characters, I just can't figure out why the loop iterates twice for the first char and then works fine after that second time through. The counts/output are otherwise correct except for the first char being duplicated. Any appreciation would be greatly appreciated. </p>
