Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 (dont 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

* include y as a vowel IF it is in any position other than the beginning of a word:

trying becomes ying-tray

but "you" becomes "ou-yay"

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.

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

Students also viewed these Databases questions

Question

What is American Polity and Governance ?

Answered: 1 week ago

Question

What is Constitution, Political System and Public Policy? In India

Answered: 1 week ago

Question

What is Environment and Ecology? Explain with examples

Answered: 1 week ago