Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ Emulator NES

Name: Anonymous 2011-12-11 12:09

Name: Anonymous 2011-12-11 13:43

Hijacking this thread because this shite site is broke as fuck

What the flying fuck is wrong with my C++ string compare?


//Stem word
string stemWord(string word)
{
    const int word_len = word.length();
    string stems[4] = {"ing","ed","er","s"};
    string temp = "";
    bool isStem;

    if (word_len > 4)
    {
        for (int i = 0; i < 4 || isStem == false; i++)
        {
            if (word.compare(word_len - stems[i].length(), stems[i].length(), stems[i]) == 0)
            {
                for (int x = 0; x < diff; x++)
                {
                    temp[x] += word[x];
                }

                word = temp;
            }       
        }
    }

    return word;
}


The word I'm sending to the is "testing," and this method is supposed to remove the stem (eg. "ing") and return the resulting stemmed word.

According to the MSDN's shitty "still, blahblah.." example (http://www.cplusplus.com/reference/string/string/compare/) this should work perfectly fine.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List