H




int main ()

Last edited on
You say 'besides one at a time' but this doesn't really make any sense to me, a sentence is made up of several words so you have to split it up into its component parts before you can convert each word.

You can split a string using istringstream like so

1
2
3
4
5
6
7
8
std::string str = "this is a string";
std::istringstream iss(str);

while (iss)
{
    std::string aWord;
    iss >> aWord; // now 'aWord' contains one word from the string
}


Note that this depends on the sentence being composed of just words and spaces, if it contains punctuation too you'll run into problems. I would just split the string like this, push each word into a std::vector, convert each word into pig latin individually then print each word in order.
Last edited on
Topic archived. No new replies allowed.