I wrote a program that lets the user input a character. If the character is a vowel, do nothing; if the character is a consonant, find the closest vowel in the alphabet. Is there any easy way to do this?
Here's what I have for now:
char input, output;
cin >> input;
if (input == 'b'){ output = 'a'; }
else if (input == 'c'){ output = 'a'; }
else if (input == 'd'){ output = 'e'; }
else if (input == 'f'){ output = 'e'; }
else if (input == 'g'){ output = 'e'; }
else if (input == 'h'){ output = 'i'; }
else if (input == 'j'){ output = 'i'; }
else if (input == 'k'){ output = 'i'; }
else if (input == 'l'){ output = 'i'; }
else if (input == 'm'){ output = 'o'; }
else if (input == 'n'){ output = 'o'; }
else if (input == 'p'){ output = 'o'; }
else if (input == 'q'){ output = 'o'; }
else if (input == 'r'){ output = 'o'; }
else if (input == 's'){ output = 'u'; }
else if (input == 't'){ output = 'u'; }
else if (input == 'v'){ output = 'u'; }
else if (input == 'w'){ output = 'u'; }
else if (input == 'x'){ output = 'u'; }
else if (input == 'y'){ output = 'u'; }
else if (input == 'z'){ output = 'u'; }
Is there a simpler way to do this?