Replacing vowels from inputted string with a different vowel.

I am trying to fill in this code that gets a user input into a string line and replacing each vowel with a different vowel. Assuming all input is lower case.

1
2
3
4
5
6
7
8
  int main()
  {
    string line;



    return 0;
   }
Coding isn’t that hard.

Give a try.
Just parse the string character by character. Then use conditional statements to check if that specific character is a vowel. If it's a vowel, you can use a random number generator to generate a number that responds to a different vowel and change the vowel from there. As Duthomhas has said, coding isn't very hard. Just give it a try.
imagine if you had a function ... that returned the input character if not a vowel, and a different vowel from input vowel if the char is a vowel. If you had that, you could use std::transform on the string and it would be done. Perhaps a switch statement would make this easy... case 'a': case 'e': ... {replace with other vowel} default: {return input} ... ?


Topic archived. No new replies allowed.