Back To C++ User Defined Functions Index
//program to create a function that check whether character passed to it as argument is vowel or not using switch case statement #include
#include
void checkvowel(char); void checkvowel(char ch) { switch(ch) { case 'a': cout<<"you entered a vowel"; break; case 'e': cout<<"you entered a vowel"; break; case 'i': cout<<"you entered a vowel"; break; case 'o': cout<<"you entered a vowel"; break; case 'u': cout<<"you entered a vowel"; break; default:cout<<"please enter a vowel (a,e,i,o,u)"; } } void main() { char ch; clrscr(); cout<<"enter a character"; cin>>ch; checkvowel(ch); getch(); }