I wrote a program that gets user input and checks if the user entered a vowel character. (These letters are vowels in English: A, E, I, O, U, and sometimes Y, and also the lower-cases.)
My problem is that I can't check if the user entered for example, 'a' and 'A'.
I Get this error:
case label value has already appeared in this switch at line 13.
My Program:
#include <iostream>
int main()
{
int i = 0;
char myString[100];
std::cout << "Enter a String "; std::cin >> myString[100];
if (std::cin.fail()) {
std::cout << "Invalid Input!";
} else {
switch (myString[100])
{
case 'a' || 'A':
i++;
break;
case 'e' || 'E':
i++;
break;
case 'i' || 'I':
i++;
break;
case 'o' || 'O':
i++;
break;
case 'u' || 'U':
i++;
break;
}
}
return 0;
}