This C++ program takes an input of an alphabet and uses a switch statement to check whether the entered alphabet is a vowel or not. Here's how the program works:
Overall, this program is a good example of how to use a switch statement in C++ to handle multiple cases. However, it could be improved by adding input validation to check that the entered input is a valid lower case alphabet. Additionally, it could be modified to handle upper case alphabets as well by converting the entered alphabet to lower case before checking for vowel status.
#include<iostream> using namespace std; int main() { char x; cout<<"\nEnter the alphabet :"; cin>>x; switch(x) { case 'a': case 'e': case 'i': case 'o': case 'u': cout<<"\n"<<x<<" is a vowel alphabet"; break; default: cout<<"\n"<<x<<"\n is not a vowel"; break; } return 0; }To download raw file Click Here
Enter the alphabet :e e is a vowel alphabet
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions