Pig Latin translator Solved

Using C, you are going to build a program that implement a translator between English and a modified version of pig Latin. Your program should first display a menu asking the user if they wish to translate from English to pig Latin, translate from pig Latin to English, or terminate the program. If the user wishes to perform a translation, prompt the user for a word or phrase, perform the translation, and output the result. As usual, you should perform as much input validation as you can. Translate from English to Pig Latin A word is a sequence of non-white space characters separated by one or more white-space characters If a word begins with a consonant letter, where a consonant letter is defined as an English letter OTHER THAN 'a', 'e', 'i', 'o', and 'u', move the first letter of the word to the end of the word, then append "ay". Maintain the former capitalization of the word. For example: "pig" becomes "igpay" "Banana" becomes "Ananabay" "cheers" becomes "heerscay" "Yummy" becomes "Ummyyay" "caw" becomes "awcay" "wow" becomes "owway" "hello!" becomes "ello!hay" If a word begins with a vowel letter, where a vowel letter is defined as 'a', 'e', 'i', 'o', and 'u', simply append "way" to the word. Maintain the former capitalization of the word. For example: "eat" becomes "eatway" "Are" becomes "Areway" "aay" becomes "aayway" Page 2 of 7 If a word begins with something other than an English letter, it is unchanged. For example: "100" remains "100" "3cents" remains "3cents" "$1.45" remains "$1.45" Translate from pig Latin to English A word is a sequence of non-white space characters separated by one or more white-space characters If the word is "way" or "Way" or “wAY” or any other variation of ‘w’ followed by ‘a’, followed by ‘y’ with any mixed capitalization it is unchanged. For example: "way" remains "way" "wAY" remains "wAY" If a word ends in "way", the "way" is truncated from the word. Maintain the original capitalization of the word. For example: "eatway" becomes "eat" "Areway" becomes "Are" "owway" becomes "ow" If a word ends in "ay" preceded by a consonant letter where a consonant letter is defined as an English letter OTHER THAN 'a', 'e', 'i', 'o', and 'u', remove the "ay" from the end of the word and move the consonant letter to the front of the word. Maintain the former capitalization of the word. For example: "igpay" becomes "pig" "Ananabay" becomes "Banana" "heerscay" becomes "cheers" "Ummyyay" becomes "Yummy" "awcay" becomes "caw" "ello!hay" becomes "hello!" All other words remain unchanged. For example: "100" remains "100" Page 3 of 7 "3cents" remains "3cents" "$1.45" remains "$1.45" "aay" remains "aay" General Requirements Note that a word translated from English to pig Latin back to English may not result in the same English word. Similarly, a word translated from pig Latin to English back to pig Latin may not result in the same pig Latin word. Your program should translate entire phrases. That is, the program should accept multiple words at a time, separated by white space
Powered by