Public feed #529673

Asad

public cpp v1 · immutable
Raw Edit
·published 2007-06-02 00:39 UTC
rendered paste body
int countSyllablesIn(char *word){        char vowels[] = "aeiouyAEIOUY";        int i;        int syls = 0;        bool flag = true;        for( i = 0; ; i++ )        {                // check if we're at the last char                if( strchr(WORD_DELIM, word[i+1] ) != NULL )                {                        if( (word[i] == 'e' || word[i] == 'E') && flag )			{                                cout << "last char is an e! " << word[i] << endl;				break;			}                        if( strchr(vowels, word[i]) != NULL && flag )                        {                                cout << "last char is a vowel and not 'e' " << word[i] << endl;                                syls++;                        }			break;                }                if ( strchr(vowels, word[i] ) != NULL )                {                        if( flag )                        {                                cout << "syllable! " << word[i] << endl;                                syls++;                                flag = false;                        }                        else                        {                                cout << "repeated syllable "  << word[i] << endl;                        }                }                else                {                        cout << "non-syllable " << word[i] << endl;                        flag = true;                }        }