i have created a C string of my variables and guessing i need some king of loop to check each character after it gets it?

i have created a C string of my variables and guessing i need some king of loop to check each character after it gets it?

Could you please post the code you have?

#include<iostream>

using namespace std;
int main()
{
string passage;
int space=0;
int sentence=0;
int word=0;
int character;
int index;
string delimeter=".:;!?";
string syllable;
string syll="aeiou";
cout<<"enter the passage to find out readability index";
getline(cin,passage);
    for (int  i = 0; i < passage.length(); i++)
    {
        //number of words
        if (isspace(passage[i]) )
        {        
            space++;
        }
        word=space+1;
        //number of sentences
        if(character=(passage.find_first_of(delimeter)))
        {
            passage.erase(0,character+1);
            sentence++;
        }
        //number of syllables
        
    //cin.get();
    }
    syllable=passage.c_str();
    cout<<"the syllable is"<<syllable;
    
    return 0;
}

so insert something like this in my for loop?

if(int index=find_first_of(syll)
    {
         substring(0,index+1);
    }

Well, actually there are strict (language) rules for splitting up a word in syllables, so I suggest you to look them up, and implement these rules in your program.
Once you've implemented them, you can start counting the syllables in a word, sentence, text.

This article has been dead for over six months. Start a new discussion instead.