Question
Task: Write a program called PigLatin which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The
Task: Write a program called PigLatin which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The program should stop when the user enters "stop". (Do not convert "stop" to Pig Latin.)
Steps: Your program must contain the following elements:
A function called isVowel which takes a character (type char) as a parameter and returns true if the character is a vowel and false if it is not. Vowels are the letters a, e, i, o, and u.
A function called findFirstVowel which takes a string as a parameter and returns the position of the first vowel occurring in the string, or -1 if there are no vowels in the string. Counting should start at 0 (like arrays), so the function should return 0 for "apple" and "orange", 1 for "cat" and "dog", 3 for "scratch", and -1 for "xyzzy". The function should go through the characters of the string one at a time and determine if each is a vowel or not. (Do not find some alternative method for locating the position of the first vowel.)
A function called pigifyWord which takes a string representing a single word as a parameter, and returns the Pig Latin version of that string. (Don't print it!)
A main program which repeatedly prompts the user for a word and prints out the Pig Latin version of that word. The program should stop when the user enters "stop". (Do not convert "stop" to Pig Latin.)
Call the various subroutines and functions as appropriate: findFirstVowel should use isVowel to determine if a particular character is a vowel or not, pigifyWord should use findFirstVowel to find the position of the first vowel in the word so you can determine how to pigify it, and main should use pigifyWord to convert each word to Pig Latin.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started