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 4PC
Program Plan Intro
Vowels and Consonants
- Include the required header files to the program.
- Declare function prototype which is used in the program.
- Define the “main()” function.
- Declare the required variables.
- Get the input c-string from the user and display the menu.
- Validate the user option.
- Switch-case statement is used to call the function according to user option and display the result.
- Define the “vowels” function.
- Declare the variables.
- The “while” loop is used to count the total number of vowels in the sentence.
- Return the result to the main function.
- Define the “consonants” function.
- Declare the variables.
- The “while” loop is used to count the total number of consonants in the sentence.
- Return the result to the main function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
python3 program :
Write a function that removes all spaces from a given string string and returns the new string.
Option #1: String Values in Reverse Order
Assignment Instructions
Write a Python function that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse order. The function is to be called from the main method.
In the main method, prompt the user for the three strings.
C++ Language
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
- c++ programming Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. If the input is: n Monday, the output is 1. If the input is: z Today is Monday, the output is 0. If the input is: n It's a sunny day, the output is 2.arrow_forwardCount the vowels in a string Create a function in Python that accepts a single word and returns the number of vowels in that word. In this function, only a, e, i, o, and u will be counted as vowels - not y.arrow_forwardCode must be in C++arrow_forward
- Programming language: F95 Write a program to declare two strings of length 7 each and then form a new string by concatenation of the two strings mentioned above. Print the two strings and concatenated string in the output.arrow_forwardC++ Programming Instructions Write a program that prompts the user for a sequence of characters (all typed on a single line) and counts the number of vowels ('a', 'e', 'i', 'o', 'u'), consonants, and any other characters that appear in the input. The user terminates input by typing either the period (.) or exclamation mark character (!) followed by the Enter key on your keyboard. Your program will not count white space characters.I.e., you will ignore white space characters.Though, the cin statement will skip white space characters in the input for you. Your program will not be case-sensitive. Thus, the characters 'a' and 'A' are both vowels and the characters 'b' and 'B' are both consonants. For example, the input How? 1, 2, 3. contains one vowel, two consonants, and six other kinds of characters. IMPORTANT: Your program must use the while statement only when looping. I.e., do not use a for statement or any other looping statement. Test 1 > run Enter text: . Your sentence has 0…arrow_forwarduse C++ Assume letters A, E, I, O, and U as the vowels. Write a program that prompts the user to enter a string and displays the number of vowels and consonants in the string. A sample run is shown below:arrow_forward
- C++ languagearrow_forwardCreate aC++ function named countWords that counts the number of words in the current string and displays a message stating how many words are in the string Examples: The string 2015 has zero words The string "Hello World" has two words The string " I am Woman " has 3 wordsarrow_forwardFunction SubStr( St As String) As String Sum=1 for x=l to 8 if x mod 2 = 0 then S=Mid(St, x, x*2) Else S=Mid(St, x, x+2) End if Next x SubStr=S End Function Sub Cmd_Click() Label.text= SubStr("Phones:987456124123456744") End Sub 987456124 :9874561241 9874561241 98745612412arrow_forward
- Learning Objectives: Python Programming Use loop over a stringReplace characters within a stringFunction (declaration and call)Write code in modular formInstructions Create a function only_chars that takes the line of text and returns the text line excluding the spaces, periods, exclamation points, or commas. Create a program that will read the input line, use the function, and then print the line, without spaces, periods, exclamation marks, or commas and their length. Ex: If the input is: Listen, Mr. Jones, calm down. the output is: ListenMrJonescalmdown21Do not forget if __name__ == "__main__" section!arrow_forwardProblem Statement: Design a program that asks the user to enter a string The string will then be displayed back to the user This is followed by determining the number of alphabetic characters numeric characters lower_case letters upper_case letters whitespace characters and then displaying them The user should be given additional chances to enter additional strings and each time a string is entered, the above process is to be performed The inputting is to stop, when the user enters "end" as the input string At that point, total number of alphabetic characters numeric characters lower_case letters upper_case letters whitespace characters are to be displayed and the program terminated An algorithm: 1. Prompt the user to enter a string at the keyboard 2. As long as the string is not "end" 2.1 Display the string, along with an appropriate message 2.2 Examine the current character of the string 2.2.1 If it's alphabetic, update the…arrow_forwardYour program will prompt the user for the following information: current population number of yearly births from the previous year number of yearly deaths from the previous year number of years into the future for your predictive value of the future population. You will then compute the following: birth rate death rate growth rate the predicted future population Assignment Notes: To allow the user to input the numeric data (such as current population) it is necessary to use the input function. The input function takes a string in parenthesis that prompts the user what to enter. The computer then waits until the user types a response, terminated by the user typing the Enter key. A string, as a sequence of characters, is returned to the variable on the lefthand side of the assignment statement. For example: currPopulation = input(“Enter the current US population”) The data in currPopulation is a string (because that is what the input statement does) but we need it to be a number…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning