Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program using C++ Write a program in a file named piglatin.cpp that will read lines of text from a file. For each word

Write a program using C++

image text in transcribed

image text in transcribed

Write a program in a file named piglatin.cpp that will read lines of text from a file. For each word in a line, the program will translate the word into Pig Latin and output it to a file. Assume that the input file meets the following specification: .All characters are lowercase alphabetic characters or spaces.Le., there are no ase letters, digits, or symbols in the in put. upperc The first character in a line is not a space. The last character of a line (i.e., before the newline) is not a space There is exactly one space between each word in a line . There are no blank lines The output file must meet the same specification. That is, the translated words of a line of input must appear in the same line in the output separated by one space and each line must end with a nonwhitespace character and a newline Rules on how to change a word into Pig Latin 1. If a word start with a vowel, simply append "ay' to the end of the word. Example: insect becomes insectay Otherwise, remove the first letter of the word, append it to the end of the word, and then append 'ay". Example: dog becomes ogday 2. A good example is: If the input file is named sample.txt and contains the following data this is a test of english into pig latin Then the output file named output.txt should contain the following results: histay isay aay esttay ofay englishay intoay igpay atinlay How to write the C+ program The program must be implemented using (at least) the following functions A function that receives a C++ string that is a line of words in all lowercase letters and passes back a string that is the Pig Latin translation of the word. E.g translate sentence (english_sentence, piglatin sentence); .A function that receives a C++ string that is a word in all lowercase letters and passes back a string that is the Pig Latin translation of the word. E.g translate word (english word, piglatin word)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions