Write a program to determine whether character is a vowel or not.
#include <iostream>
using namespace std;
int main() {
char ch;
cout << "Enter a letter: ";
cin >> ch;
switch (ch) {
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'u':
case 'U':
cout << ch << " is a vowel" << endl;
break;
case 'w':
case 'W':
case 'y':
case 'Y':
cout << ch << " is a semivowel" << endl;
break;
default:
cout << ch << " is a consonant" << endl;
}
return 0;
}
Comments
Leave a comment