Question: Pig Latin Program Write a C++ program that encodes English-language phrases into pig-Latin. Pig-Latin is a form of coded language often used for amusement. According
Pig Latin Program
Write a C++ program that encodes English-language phrases into pig-Latin. Pig-Latin is a form of coded language often used for amusement.
According to a credible source:
Pig-Latin is a language game primarily used in English. An alternative British name for Pig-
Latin is backslang (in Britain this term more often applies to the type of backslang used by the criminals of 19th century London and used as a playground game today, which was based on turning words backwards), or Butcher's Backslang which was common in English Butcher's shops at least until World War II. Prior to this, Benjamin Franklin was known to use a version of Pig-Latin in some publications. Pig-Latin is usually used by children for amusement or to converse in (perceived) privacy from adults or other children. Conversely, adults sometimes use it to discuss sensitive topics they do not want very young children to overhear.
Many variations exist in the methods used to form pig-Latin phrases. For simplicity, use the following algorithm:
To form a pig-Latin phrase from an English-language phrase, tokenize the phrase into words. Place the letters of the English word that occur before the first vowel at the end of the English word and add the letters ay. Thus the word jump becomes umpjay, the word the becomes ethay and the word computer becomes omputercay. Blanks and punctuation marks between words remain unchanged. If a word in the English phrase was capitalized your program will have to change the case of the pig-Latin phrase accordingly. Thus the word Professor would become Ofessorpray.
Words that begin with a vowel should simply have way added to the end of the word. For example, egg becomes eggway.
At the end of your program print the following statistics:
1. the number of words in the text
2. the number of letters in the text (after the conversion to pig latin)
3. the number of all characters in the text (including punctuation but NOT whitespace)
Function suggestions:
//precondition: word is not empty
//postcondition: returns a string that is the pig latin version of word
string convertToPigLatin(string word);
//postcondition: returns true if letter is a vowel, false otherwise
bool isVowel(char letter);
void getWords(vector
Having it read in from a file:
This is a, bunch of words.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
