Question: Original problem... Here is the current code.... #include #include using namespace std; bool isVowel(char ch) { if(ch == 'a' || ch == 'A' || ch

Original problem...

Original problem... Here is the current code.... #include #include using namespace std;

Here is the current code....

#include #include

using namespace std;

bool isVowel(char ch) { if(ch == 'a' || ch == 'A' || ch == 'e' || ch == 'E' || ch == 'i' || ch == 'I' || ch == 'o' || ch == 'O' || ch == 'u' || ch == 'U' ) { return true; } else { return false; }

}

int vowelIndex(string str){ for(int i = 0; i

string pigLatin(string str){ string latin = ""; int index = vowelIndex(str); if(index == -1 || index == 0){ return str + "ay"; } else{ return str.substr(index) + "-" + str.substr(0, index) + "ay"; } }

int main() { string wtf; cout > wtf;

cout

return 0; }

I need help changing this to convert phrases and sentences, not just the first word. Also, adding some comments explaining what was done would be great!

Write a C++ Program for (Pig Latin) A language game, such as Pig Latin, alters spoken words to make them incomprehensible to the untrained ear. Write a program to prompt the user for an English word, phrase, or sentence and then translate the words into Pig Latin, as follows: the initial consonants are moved from the front of the word to the end and the letters "ay" are then added to the end. Thus meal" becomes "eal-may", "scram" becomes "am-scray", and "java" becomes "ava- jay". If the word begins with a vowel, then just add "ay" to the end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!