For this assignment, you will write a function that converts a single English wo
ID: 3568227 • Letter: F
Question
For this assignment, you will write a function that converts a single English word to its pig Latin equivalent. That function should have a header as follows: string convertToPigLatin (string inStr) You?ll note that it takes a string as input and returns a string, as expected. That return value can then be assigned to a variable, printed out, or written to an output file. Your program should then perform the following steps: 1) Open a file for input called pigLatinIn.txt, which will be provided to you. This file will consist of one English word per line. 2) Open a file for output called pigLatinOut.txt. 3) Your program will then read the input file, use the convertToPigLatin() function to determine the pig Latin equivalent to the word, then write the following to the output file: ?English word ------------ cabin apple Pig Latin Word -------------- abin-cay apple-way 4) Print out the results in all lower case.
Explanation / Answer
#include 02 #include 03 04 using namespace std; 05 06 const string strVOWELS = "aeiouAEIOU"; 07 const string strDELIMITERS = " ,./;:-_+[{]}!?"; 08 09 bool IsAVowel(char c) 10 { 11 return strVOWELS.find(c) != string::npos; 12 } 13 14 bool IsADelimiter(char c) 15 { 16 return strDELIMITERS.find(c) != string::npos; 17 } 18 19 int main() 20 21 { 22 coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.