I figure out how to get it to change the sentence into piglatin, but after hours of searching on how to ignore punctuation, I am still confused on how to do this. I want the punctuation to be at the end of any word that has any punctuation. How should I do this?
struct Word
{
string english;
string piglatin;
};
Word * piglatinCon(Word sentenceArr [], int &wordNum)
{
string s, c;
int i = 0;
Word *str = nullptr;
str = new Word[wordNum];
for (int count = 0; count < wordNum; count++)
{
if (*sentenceArr[count].english.begin() != 'e' && *sentenceArr[count].english.begin() != 'i' && *sentenceArr[count].english.begin() != 'o' && *sentenceArr[count].english.begin() != 'u' && *sentenceArr[count].english.begin() != 'a' && *sentenceArr[count].english.begin() != 'E' && *sentenceArr[count].english.begin() != 'I' && *sentenceArr[count].english.begin() != 'O' && *sentenceArr[count].english.begin() != 'A' && *sentenceArr[count].english.begin() != 'U')
{
// Converts to pig latin
c = *sentenceArr[count].english.begin();
s = sentenceArr[count].english.erase(0, 1);
str[i].piglatin = s + c + "ay";
}
// Any other letter it will just add way to the end of the word
else
str[i].piglatin = sentenceArr[count].english + "way";
i++;
}
return str;
}
Thanks for your help, I was able to remove the punctuation and then do the piglatin conversion. So now I want to add the punctuation after the conversion, so is there any way to do this?