Reverse the order of the words and print all letters in


Pig Latin Strings

Write a Program in C++.

Task: Input various sentences as C-strings and perform 2 conversions on each sentence using C-string commands.

1. Reverse the order of the words, and print all letters in upper case; there will be no punctuation in this version.

2. Change the original line to pig latin; print this version all in lower case except start the pig latin sentence with a capital letter. The only punctuation will be a period at the end.

The entire program will be written using only C-strings. Do not use string class objects for any part of it. As you process the conversions, assemble the results into complete strings, and print out only complete strings (don't print a word at a time or a char at a time as you loop through a string).

There are various ways that this program may be written. If you choose to use strtok, remember to make a copy of each word as it is extracted from the original string. Don't use the word pointer itself, or the loop will not work correctly.

Pig Latin rules:

* if a word begins with a vowel, append "-way" to the end:

            "eye" becomes "eye-way"

* if a word starts with a consonant, identify the consonants up to the first vowel and move these consonants to the end of the word, then add "ay":

            "slant" becomes "ant-slay"

Input: Input can be interactive or read from a file.

For the printed output, use at least these lines as input:

            I love Paris in the Spring time.

            Mary, my friend, had a lamb.

            Hello? Hello? Are you still there?

            John said, "Whoop Dee Doo!", then skipped, hopped, and twirled.

Output: Send the output to an external file. Print a header at the top of the page with at least your name, the date, and a title. Then print each input line, followed by the two conversions.

Example:

If the input line was:

            Hello? Hello? Are you still there?

The output would be:

            Hello? Hello? Are you still there?

            THERE STILL YOU ARE HELLO HELLO

            Ello-hay ello-hay are-way ou-yay ill-stay ere-thay.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Reverse the order of the words and print all letters in
Reference No:- TGS02887350

Expected delivery within 24 Hours