You will be creating a program that translates Pig Latin to English and Vice-Versa.
Consider the next word in the phrase.
Place the first letter of the word at the end of the word.
Add the letters ay or tay to the end of the word.
Continue until there are no more words.
For example, the above algorithm translated into Pig Latin would be:
Onsidercay hetay extnay ordway nitay hetay hrasepay.
Lacepay hetay irstfay etterlay fotay hetay ordway tatay hetay ndetay fotay hetay ordway.
Ddatay hetay etterslay yatay rotay aytay hetay ndetay fotay hetay ordway.
Ontinuecay ntilutay heretay reatay onay oremay ordsway.
Although there are many different dialects of Pig Latin, your program will use the rules for the General Modified Universal (GMU) dialect of the language:
Your program must be able to use correct punctuation and capitalization as shown in the above example. For instance, the word "Place" should become "Lacepay" and not "lacePay" in order to keep the capitalization and punctuation consistent. The only punctuation you need to worry about are periods, commas, colons and semi-colons. You may assume that input text will not contain quotation marks or apostrophes.
You will then write a function that translates Pig Latin phrases back into English. Declare and implement the function "TranslateToEnglish()" in order to accomplish this. Your Menu should include this new option, as well as a way to allow the user to input a phrase in Pig Latin, which may then be translated back to English by your program.
Below is a suggested struct definition for the individual nodes of your linked lists:
#define MAX_WORD_CHARS (30)
typedef struct WordNodeType
struct WordNodeType *next;
Whatever the definition for your node, you will need to implement the following functions:
WordNode* translateWord (WordNode* NextWord)
Precondition: NextWord is passed in as a parameter and points to a WordNode containing and English word.
Postcondition: A pointer to a new node containing the Pig Latin translation of NextWord is returned to the calling function using a return statement. NextWord remains unchanged.
void printPhrase (WordNode* Phrase)
Postcondition: If Phrase points to a valid linked list, all the words contained in the list have been printed in the order that they appear in the list.
If Phrase is a NULL pointer, an appropriate message is printed.
Add whatever additional functions and variables you wish to implement the program.
As long as you properly implement the queues using linked lists of nodes allocated using memory from the heap, together with the above two functions, you may implement the remainder of your Pig Latin translation program however you like.