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...
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 endStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started