Write a program that converts a string to its Pig-Latin equivalent. To convert a string to Pig-Latin use the following algorithm:
1. If the string begins with a vowel, add "way" to the string. For example, Pig-Latin for “apple” is “appleway.”
2. Otherwise, find the first occurrence of a vowel, move all the characters before the vowel to the end of the word, and add "ay". For example, Pig-Latin for “strong” is “ongstray” since the characters “str” occur before the first vowel.
Assume that vowels are a, e, i, o, and u. You’ll find it useful to write several functions to help in converting a string to its Pig-Latin equivalent. You’ll need to use string member functions substr, find, and length. You’ll also need to concatenate strings using +. Finally, to find the first vowel, you may find it useful to write a function that returns the minimum of two values. You’ll need to be careful with the value string::npos returned by the string member function find. Sample output for the program follows.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here