Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pig Latin is a language game. Each word is spoken starting with its first vowel. Any preceding consonants are moved to the end of the

Pig Latin is a language game. Each word is spoken starting with its first vowel. Any preceding consonants are moved to the end of the word and added to a vocalic syllable to form a new syllable. For example, the word Eye is pronounced Eye-way in pig Latin.

The rules for converting a string into a pig Latin form are as follows:

If the string begins with a vowel, add the string "-way" at the end of the string. For example, the pig Latin form of the string "eye" is "eye-way". Note that pig Latin consider y as a vowel, meaning we have the following vowels in total: a, e, i, o, u, y, A, E, I, O, U, and Y.

If the string does not begin with a vowel, follow these steps: Add "-" at the end of the string.

Rotate the string one character at a time (that is, move the first character of the string to the end of the string and so on) until the first character of the string becomes a vowel.

Add the string "ay" at the end. For example, the pig Latin form of the string "There" is "ere-Thay".

Strings such as "1234" contain no vowels. The pig Latin form of the string "1234" is "1234- way". That is, the pig Latin form of a string that has no vowels in it is the string followed by the string "-way".

Write a program that (1) takes an English Phrase (a sentence with many words) and outputs its pig Latin version, and (2) takes a pig Latin Phrase (a sentence with many words) and produces the original English one

In C++ Language?

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