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
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