in c++. > word > charset;Where word and charset are arbitrarily named variables to store the word and character set.Hint: You can use substr(i, I) function where i is the index into the string and I...


in c++.


write a function that, given a word and a set of characters,<br>filters the all occurrences of those characters from the word. For e.g.<br>remove_chars(> word > charset; Where word and charset are arbitrarily named variables to store the word and character set. Hint: You can use substr(i, I) function where i is the index into the string and I is the number of characters to extract. It would be easier if you stored the output in a separate variable. Write this function recursively. Do not use any loops. Hint: You will need to create a helper function (also recursive) that checks if any given letter in the word is present in the charset. This function can be prototyped as follows: bool contains(string letter, string charset) If you do the recursion properly, you will realize your code is more concise and readable "/>
Extracted text: write a function that, given a word and a set of characters, filters the all occurrences of those characters from the word. For e.g. remove_chars("abcdeeeeefmnop", "ebo") returns: acdfmnp i.e all occurrences of e, b and o have been removed from abcdeeeeefmnop You should acquire the word and set of characters both from the user and then pass them to the function. Note: std:cin terminates when it encounters a space, you should take the word and character set as separate inputs: std:cin >> word > charset; Where word and charset are arbitrarily named variables to store the word and character set. Hint: You can use substr(i, I) function where i is the index into the string and I is the number of characters to extract. It would be easier if you stored the output in a separate variable. Write this function recursively. Do not use any loops. Hint: You will need to create a helper function (also recursive) that checks if any given letter in the word is present in the charset. This function can be prototyped as follows: bool contains(string letter, string charset) If you do the recursion properly, you will realize your code is more concise and readable
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here