Using the attached pigLatinString.cpp as a starting point, create a Pig Latin Converter program that will read in a file called “pigLatinFile.in” of English sentences, convert them into Pig Latin, and will output them back to a file called “pigLatinFile.out”.
1) While I may not use the same input file provided to you, you can be assured that it will contain no more than 500 words on the same line like the sample input file provided here.
2) You can name your cpp file for this assignment anything you wish, so long as you attach it with your submission and it will read in and output the exact file names above and like the sample files.
1) The comma (,) and period(.) characters will be considered special punctuation characters, and even after conversion to Pig Latin, these characters will need to still appear at the end of each word. All other characters can be left where Malik’s “rotate” function puts them in the word.
2) If the first letter of the English word is capitalized, then the first letter of the word converted into Pig Latin should also be capitalized.
An Example of these Requirements is “David,” converted into Pig Latin by your program should be “Avid-day,”
The sample program I gave can only translate one word to programming Latin, I need you to enter a lot of text instead of just one word.
// Program: Pig Latin Strings
// This program reads a string and outputs the pig latin form
// of the string.
using namespace std;
bool isVowel(char ch);
string rotate(string pStr);
string pigLatinString(string pStr);
cout << “Enter a string: “;
cin >> str;
cout << endl;
cout << “The pig Latin form of ” << str << ” is: ”
<< pigLatinString(str) << endl;
bool isVowel(char ch)
string rotate(string pStr)
string::size_type len = pStr.length();
rStr = pStr.substr(1, len – 1) + pStr;
string pigLatinString(string pStr)
if (isVowel(pStr)) //Step 1
pStr = pStr + “-yay”;
else //Step 2
pStr = pStr + ‘-‘;
pStr = rotate(pStr); //Step 3
len = pStr.length(); //Step 3.a
foundVowel = false; //Step 3.b
for (counter = 1; counter < len – 1;
counter++) //Step 3.d
foundVowel = true;
else //Step 3.c
pStr = rotate(pStr);
if (!foundVowel) //Step 4
pStr = pStr.substr(1, len) + “-way”;
pStr = pStr + “ay”;
return pStr; //Step 5
Harry Potter is a series of fantasy novels written by British author J. K. Rowling. The novels chronicle the life of a young wizard, Harry Potter, and his friends Hermione Granger and Ron Weasley, all of whom are students at Hogwarts School of Witchcraft and Wizardry. The main story arc concerns Harry’s struggle against Lord Voldemort, a dark wizard who intends to become immortal, overthrow the wizard governing body known as the Ministry of Magic, and subjugate all wizards and non-magical people.
Arry-hay Otter-pay is-yay a-yay eries-say of-yay antasy-fay ovels-nay itten-wray y-bay Itish-bray author-yay J-way. K-way. Owling-ray. E-thay ovels-nay onicle-chray e-thay ife-lay of-yay a-yay young-yay izard-way, Arry-hay Otter-pay, and-yay is-hay iends-fray Ermione-hay Anger-gray and-yay On-ray Easley-way, all-yay of-yay om-whay are-yay udents-stay at-yay Ogwarts-hay Ool-schay of-yay Itchcraft-way and-yay Izardry-way. E-thay ain-may ory-stay arc-yay oncerns-cay Arry’s-hay uggle-stray against-yay Ord-lay Oldemort-vay, a-yay ark-day izard-way o-whay intends-yay o-tay ecome-bay immortal-yay, overthrow-yay e-thay izard-way overning-gay ody-bay own-knay as-yay e-thay Inistry-may of-yay Agic-may, and-yay ubjugate-say all-yay izards-way and-yay on-magical-nay eople-pay.