Question: Im writing a c++ program to translate a sentence to pig latin. But I keep getting an error where it only prints out the ay
Im writing a c++ program to translate a sentence to pig latin. But I keep getting an error where it only prints out the "ay" part. Not sure where I'm wrong here.
string piglatin(string); string substr(string, int&);
int main () //begin main { string input; cout<<"Enter a sentence to convert: "; getline(cin, input); cout<<"Converted to Pig Latin: "< while(s[n]!=' '&&s[n]!='\0') //while(s[n]!=' '&&s[n]!='\0') { word[i]=s[n]; n++; i++; } strcpy(word,suffix); //add the suffix strcpy(word,"ay");//add ay to it return word;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
