Question: Question in C. Write a program that encodes English language phrases into Pig Latin. Pig Latin is a form of coded language often used for
Question in C.
Write a program that encodes English language phrases into Pig Latin. Pig Latin is a form of coded language often used for amusement. Many variations exist in the methods used to form Pig Latin phrases. Use the following algorithm: to form a Pig Latin phrase from an English language phrase, tokenize the phrase into words with the C function strtok(). To translate each English word into a Pig Latin word, place the first letter of the English word at the end of the English word and add the letters ay after it. Thus, the word jump becomes umpjay, the word the becomes hetay, and the word computer becomes omputercay. Blanks between words remain as blanks. Assume that the English phrase input from the keyboard consists of words separated by blanks, there are no punctuations marks, all words have 2 or more letters, and the input phrase is less than 200 characters. Function printLatinWord() should display each word. Hint: Each time a token is found in a call to strtok(), pass the token pointer to function printLatinWord() and print the Pig Latin word. Your program should allow the user to enter phrases until he or she selects an exit option. Consider creating a Pig Latin class to implement this functionality. If you do, design proper constructors/destructors and member functions for the class. Assume keyboard input and display output for the program.
Program should be able to accept an input text file and display the output in a output text file or display on the screen depending on the users input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
