Question: Using C++, complete the following program. It is important that you follow the directions carefully and that your output matches the sample output below. Please

Using C++, complete the following program. It is important that you follow the directions carefully and that your output matches the sample output below. Please include a screenshot of your output. The main function shouldn't be more than a couple lines long, and the whole program shouldn't be more than two pages long.

This is a not an ordinary Pig Latin. Write a program that reads a sentence as input and converts each word from English to Pig Latin. In this version, to convert a word to Pig Latin you first convert user input to upper case, find the substring GH if there is one, and remove the rest of the c-string include GH. Then you append the c-string ay to the end of the word. Here are some examples:

English:

night

Pig Latin:

niay

English:

niGHt

Pig Latin:

niay

English:

No G H here

Pig Latin:

NO "G - H" HEREay

Repeat until user has entered a QUIT (regardless of case). You are required to use c-strings for this program.

Functions:

Main function should be shorter than half a page.

Function header

Explanation

void convertToUpper(char * str)

This function should covert the given c-string to upper cases

void findAndRemove(char* str)

This function should find the substring GH in the given c-string, and remove the rest of the c-string include GH

void appendAy(char* str)

This function should only be called when you have successfully removed GH and the remaining string. Append a ay (lower case) towards the end of the c-string.

void convertPigLatin(char * str)

This function should provide a do-while loop (or a while loop) to convert user input to upper case first, then calls findAndRemove and appendAy in that order. Notice your program should stop as soon as user has entered a quit message regardless of the case (e.g. Quit is acceptable). Display a message Over! when the process is finished.

Hints:

ay will be attached to the end of the c-string regardless

No inputs are longer than 180 characters, guaranteed.

No input validation needed.

Sample Output:

Please enter a string, enter quit to stop the process:

night

NIay

Please enter a string, enter quit to stop the process:

niGHT

NIay

Please enter a string, enter quit to stop the process:

No "G - H" here

NO "G - H" HEREay

Please enter a string, enter quit to stop the process:

First they ignore you, then they laugh at you, then they fight you, then you win.

FIRST THEY IGNORE YOU, THEN THEY LAUay

Please enter a string, enter quit to stop the process:

then they fight you, then you win.

THEN THEY FIay

Please enter a string, enter quit to stop the process:

QUIT

Over!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!