Question: You must implement: string rotate_vowels(string& s); This function must accept a string parameter s by reference, and change it directly by replacing each vowel with

You must implement: string rotate_vowels(string& s); This function must accept a string parameter s by reference, and change it directly by replacing each vowel with its alphabetical successor among vowels defined circularly.

That is, replace a with e, e with i, i with o, o with u and u with a.

For example, after executing the following two lines, string s = "that's really cool";

rotate_vowels(s); the variable s should contain the string "thet's rielly cuul"

rotate_vowels(s); the variable s should contain the string "thet's rielly cuul"

In addition to changing the parameter passed in by reference, it must ALSO return this parameter.

See what happens if you implement a case-sensitive version of this function.

Useful guide: If your code for this function is over 15 lines including comments, look for signs of over-coding.

Template code: below must be in C++

  • #include

  • #include

    using namespace std; // Note that the string is passed in by reference. So the caller may not rely on the result being returned.
  • // TODO - Your code for rotate_vowels goes here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!