Q:

Why isn't this x value increasing in this map for loop? c++

The purpose of this loop is to look through a 2d vector and count the frequency in which a value in the first column appears. If the value shows up all three times, then it is good to go. If it doesn't then I would like to delete the row that it's in from the vector. The "it" iterator stores the value as (value, frequency). 
I can't figure out how to delete the row at this point though, i have been trying to use a counter "x" in the second for loop so that it can keep track of which row it is on, but when i run it through the debugger the x doesn't increment. What ends up happening is the vector deletes the first rows instead of the rows that make the if statement true.
Why isn't the "x" incrementing? Is there a different method i could use to keep track of which row the loop is currently in?
"data" is the 2d vector. 
        for (int i = 0; i < data.size(); i++) // Process the matrix.
        {
            occurrences[data[i][0]]++;
        }

        for (map<string, unsigned int>::iterator it = occurrences.begin(); it != occurrences.end(); ++it) 
        {
            int x = 0;
            if ((*it).second < 3) // if the value doesn't show up three times, erase it
            {
                data.erase(data.begin() + x);
            }
            cout << setw(3) << (*it).first << " ---> " << (*it).second << endl; // show results

            x++;
        }   

A:

You reset x back to 0 every loop. Initialize it outside the loop and it should work.
int x = 0;

