Question
Find a way to remove vowels and certain other groups of characters from a string. Your assignment: Write and test a C++ program that prompts
Find a way to remove vowels and certain other groups of characters from a string. Your assignment: Write and test a C++ program that prompts the user to input a string. The program then uses a user-defined function to remove all the vowels from the string. Do not replace the vowels with any other character. For example, if str = There, then after removing all the vowels, str = Thr. After removing all the vowels, output the string.
Discussion: Removing characters from a string involves two operations: 1) recognizing which characters in the string fall within the group being removed, and 2) removing those characters from the string. Consider the following steps to accomplish these tasks. Develop a function that accepts a string, iterates through the characters in the string, and removes each character that is a member of the group known as vowels. The function should return an edited version of the original string. Write a main program that reads a string of one or more words from the console, uses the userdefined function (described above) to remove all the vowels from the input string, and then displays the input string and vowel-less result string. Repeat till the user opts to quit.
Coding Accept any sequence of characters, including embedded spaces from the input. Your program must contain at least one function to remove the vowels from a string. Validate all inputs and do not proceed until valid inputs are available. For the purposes of this assignment, vowels include only the letters a, e, I, o, and u in both upper case and lower case. Format your source code according to the style guide presented in class.
Bonus Allow the user to specify one of the following groups of characters to remove from the input string: vowels, consonants, digits, and punctuation. Allow the user to specify a group of user-selected characters to remove from the input string. This option must not be included without the previous bonus feature.
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