Menu

[solved] – Question 79817

Using the class “string” from the C++ standard library, write the statements to perform the following tasks.
(Do not write an entire C++ program.) Assume that there are two string variables containing words separated by one or more blanks with no special characters. Numbers within the strings are valid.

Compare string1 to string2 to determine if they have the same number of vowels (a,e,i,o,u).
Hint: Use the string method “find_first_of” in a loop for each string.
Make a copy of the longest word from the string1 and insert it into string2 after the first word. (Maintain blanks between all words in string2.)
Hint: Use the string methods “find” and “insert”.

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *