Design a C++ program that takes character input from user and checks whether that letter is vowel alphabet or not using if...else statement
#include <iostream>
#include <string.h>
using namespace std;
int main() {
 //check vowels letter
 char ch;
 cout<<"Please enter a character: ";
 cin>>ch;
 bool isVowel=ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'
  ||ch=='o'||ch=='O'||ch=='u'||ch=='U';
 char ans[2][50];
 strcpy(ans[1],"Yes Vowel:");
 strcpy(ans[0],"No It\'s doesnot vowel letter");
 cout<<ans[isVowel]<<endl;
 return 0;
}
Comments
Leave a comment