Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that will input a phrase and convert it to pig latin. Put each word in a separate element of a string array.

Write a program that will input a phrase and convert it to pig latin. Put each word in a separate element of a string array. Remove the first letter from each word and concatenate it to the end of the word followed by ay.

Please write c++ code follwing this Pseudocode: Main function Display the heading Declare originalString, newString While the condition is true Prompt the user for group of words or Enter to quit Test for empty string and exit loop if empty string Display original words Call function pigLatinString( ) assign to newString Display newString End while pseudo code for translation of pigLatinString // string parameter(originalString) and returns a string Declare and initialize string variables len, counter, word and newString and size_t variables start, begin, While condition is true Call find() and pass a space and start as parameters and return the returned value to start if start equals to string::npos jump outside the loop permanently call substr() function passing begin and start-begin and return the returned value to word //display the word for debugging purposes only update newString - add the rest of the word(use substr passing it 1) + the first letter(use substr passing it 0 and 1) + ay + a space increment start by one assign start to begin End While Call substr() function passing begin and start-begin and return the returned value to word //display the word for debugging Update newString - add the rest of the word + the first letter + ay + a space Return newString

Sample output:

*****************************************************

* You will be prompted to enter a string of *

* words. The string will be converted into *

* Pig Latin and the results displayed. *

* Enter as many strings as you would like. * ******************************************************

Enter a group of words or ENTER to quit: Computer Programming is fun to learn!

Original words: Computer Programming is fun to learn!

New Words: omputercay ogrammingpray isway unfay otay earnlay!

Enter a group of words or ENTER to quit: Quit

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions