Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 12, Problem 16PC
Program Plan Intro
Pig Latin
- Include the required header files to the program.
- Declare function prototypes which are used in the program.
- Define the “main()” function.
- Declare the required variables.
- Get the input from the user.
- Translate each word from the sentence and create the Pig Latin sentence.
- Call the function “pop_word” for getting the next word from the string.
- Call the function “pig_latin” for translates each word from the sentence.
- Print the output.
- Define the “pop_word” function.
- Call the “trim” function to trim the space between the sentences.
- Copy the substring and store it in a variable.
- Delete the word from the sentence.
- Return that word.
- Define the “trim” function.
- The spaces between the words are removed in this function.
- Return that word
- Define the “pig_latin” function.
- Read the string and append the first letter.
- Join the “AY” characters at the end of the strings.
- Remove the first letter.
- Return that word.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
French Articles: French country names are feminine when they end with the letter e, masculine otherwise, except for the following which are masculine even though they end with e:
le Belize
le Cambodge
le Mexique
le Mozambique
le Zaïre
le Zimbabwe
Write a program that reads the French name of a country and adds the article: le for masculine or la for feminine, such as le Canada or la Belgique. However, if the country name starts with a vowel, use l’; for example, l’Afghanistan. For the following plural country names, use les:
les Etats-Unis
les Pays-Bas
4. Word Separator:Write a program that accepts as input a sentence in which all of thewords are run together
but the first character of each word is uppercase. Convert the sentence to a string in which the words are
separated by spaces and only the first word starts with an uppercase letter. For example the string
"StopAndSmellTheRoses." would be converted to "Stop and smell the roses.
*python coding
Q: People often forget closing parentheses when entering formulas. Write a program that asks the user to enter a formula and prints out whether the formula has the same number of opening and closing parentheses.
Q: Write a program that asks the user to enter a word and prints out whether that word contains any vowels.
Q: Write a program that asks the user to enter a string. The program should create a new string called new_string from the user’s string such that the second character is changed to an asterisk and three exclamation points are attached to the end of the string. Finally, print new_string. Typical output is shown below: Enter your string: Qbert Q*ert!!!
Q: Write a program that asks the user to enter a string s and then converts s to lowercase, removes all the periods and commas from s, and prints the resulting string.
Q: Write a program that asks the user to enter a word and determines whether the word is a palindrome or not. A palindrome is a word that reads the same…
Chapter 12 Solutions
Starting Out With C++: Early Objects (10th Edition)
Ch. 12.2 - Write a short description of each of the following...Ch. 12.2 - What will the following program segment display?...Ch. 12.2 - Prob. 12.3CPCh. 12.2 - Prob. 12.4CPCh. 12.2 - Write code that uses the cin.get1ine function read...Ch. 12.2 - Indicate whether the following strcmp function...Ch. 12.2 - Prob. 12.7CPCh. 12.3 - Write a short description of each of the following...Ch. 12.3 - Write a statement that will convert the C-string...Ch. 12.3 - Prob. 12.10CP
Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Prob. 12.12CPCh. 12.4 - What is the output of the following program?...Ch. 12 - A(n)___________is represented in memory as an...Ch. 12 - The____________ statement is required before the...Ch. 12 - A(n)____________is written in your program as a...Ch. 12 - Prob. 4RQECh. 12 - The______________ is used to mark the end of a...Ch. 12 - Prob. 6RQECh. 12 - Prob. 7RQECh. 12 - Prob. 8RQECh. 12 - Prob. 9RQECh. 12 - Prob. 10RQECh. 12 - Prob. 11RQECh. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - Prob. 14RQECh. 12 - Prob. 15RQECh. 12 - Prob. 16RQECh. 12 - Prob. 17RQECh. 12 - Prob. 18RQECh. 12 - Write a function whose prototype is char...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #include iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #inc1ude iostream #inc1ude cstring using namespace...Ch. 12 - #inc1ude iostream using namespace std; int main()...Ch. 12 - #inc1ude iostream #inc1ude string using namespace...Ch. 12 - #include iostream #inc1ude cstring using namespace...Ch. 12 - #include iostre4m #inc1ude cstring using namespace...Ch. 12 - Each of the following programs or program segments...Ch. 12 - Soft Skills 30. You are a member of a...Ch. 12 - Prob. 1PCCh. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Prob. 4PCCh. 12 - Name Arranger Write a program that asks for the...Ch. 12 - Prob. 6PCCh. 12 - Prob. 7PCCh. 12 - Prob. 8PCCh. 12 - Prob. 9PCCh. 12 - Password Verifier Imagine you are developing a...Ch. 12 - Prob. 11PCCh. 12 - Check Writer Write a program that displays a...Ch. 12 - Prob. 13PCCh. 12 - Dollar Amount Formatter Modify Program 12-13 by...Ch. 12 - Word Separator Write a program that accepts as...Ch. 12 - Prob. 16PCCh. 12 - I before e except after c A friend of yours who is...Ch. 12 - User Name Write a program that queries its...Ch. 12 - String Splitter Write a function vectorstring...Ch. 12 - Palindromic Numbers A palindromic number is a...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Pig Latin is a nonsense language. To create a word in pig Latin, you remove the first letter and then add the first letter and ay at the end of the word. For example, dog becomes ogday and cat becomes atcay. Write a program named PigLatin that allows the user to enter a word and displays the pig Latin version.arrow_forwardThis string method returns true if a string contains only alphabetic characters and is at least one character in length.a. the isalpha methodb. the alpha methodc. the alphabetic methodd. the isletters methodarrow_forwardIn the class String, the substring method inserts a String into another String. -True or -Falsearrow_forward
- This string method returns a copy of a string with all the alphabetic letters converted to uppercase.a. uppercase()b. case_upper()c. upper()d. to_upperCase()arrow_forwardQ1: Write a program that reads 10 numbers and then finds the largest number and prints it and finds the smallest number and eyarrow_forwardC programming Code with comments and output screenshot is must. Thank you!arrow_forward
- in python String user_string is read from input with leading and trailing whitespaces. Remove any leading and trailing whitespaces in the string. If user_string contains the string 'Paint color:', lowercase all the characters in user_string. Otherwise, capitalize the first character in user_string. Finally, print out the resulting string.arrow_forwardJAVA CODE PLEASE Using conditional and looping structures, make a simple calculator that does the following: First, the program should get a single string ? from the user, so that it knows what type of operation it is supposed to perform. If ? is "negate", obtain one number from the user, then negate the number. Output the negated number. If ? is "add", obtain two numbers from the user, then add the two numbers. Output the sum. similar goes to "subtract" & "multiply" division is excluded If ? is "max", obtain two numbers from the user, then get the larger value between the two numbers. If the numbers are equal, output any of them. Input: The first line of input contains a single integer ? (1≤?≤10), which is the number of operations you have to perform. This is followed by a single line containing ? operations separated by a single space. The start of each operation contains a string (which can be negate, add, subtract, multiply or max). If the string is negate, this will be…arrow_forwardJava code please Using conditional and looping structures, make a simple calculator that does the following: First, the program should get a single string ? from the user, so that it knows what type of operation it is supposed to perform. If ? is "negate", obtain one number from the user, then negate the number. Output the negated number. If ? is "add", obtain two numbers from the user, then add the two numbers. Output the sum. similar goes to "subtract" & "multiply" division is excluded If ? is "max", obtain two numbers from the user, then get the larger value between the two numbers. If the numbers are equal, output any of them. Input: The first line of input contains a single integer ? (1≤?≤10), which is the number of operations you have to perform. This is followed by a single line containing ? operations separated by a single space. The start of each operation contains a string (which can be negate, add, subtract, multiply or max). If the string is negate, this will be…arrow_forward
- Alert dont submit AI generated answer. answer all questionarrow_forwardThis string method returns true if a string contains only numeric digits and is at least one character in length.a. the digit methodb. the isdigit methodc. the numeric methodd. the isnumber methodarrow_forward7bact1 Please help me answer this in python programming.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT