Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 2 (THIS IS FOR C PROGRAMMING) Filename: piglatin.c Write a function, called ToPigLatin , which is described below: Write a function for which the
Exercise 2 (THIS IS FOR C PROGRAMMING)
Filename: piglatin.c
Write a function, called ToPigLatin, which is described below:
- Write a function for which the prototype is shown below:
char* ToPigLatin(char* sentence);
This function receives a c-style string (word) as a parameter.
- You are to define this function so that it converts the incoming string (character array) to its "Pig Latin" version, and then have the function return a pointer to the string
- For our purposes, we will use the following as the rules for translation of a word into "Pig Latin":
- A sentence is a consecutive sequence of letters (a-z, A-Z) or apostrophes with space. Examples: I am a cat
- If a word starts with a vowel, the Pig Latin version is the original word with "way" added to the end
- If a word starts with a consonant, or a series of consecutive consonants, the Pig Latin version transfers all consonants up to the first vowel to the end of the word, and adds "ay" to the end.
- The letter 'y' should be treated as a consonant if it is the first letter of a word, but treated as a vowel otherwise.
- If the original word is capitalized, the new Pig Latin version of the word should be capitalized in the first letter (i.e. the previous capital letter may not be capitalized any more).
- You may assume that a "sentence" to be entered into the function is no more than 39 characters.
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