C++ – Input Character and Display Vowel or Not

Write a program that prints the ASCII code of the input character (both upper case and lower case) and displays whether the character is a vowel or not.
e.g. if ‘A’ is inputted then the output should be 65 and should display ‘vowel’.
- C++ Program to Implement Unary Operator Overloading
- C++ Program to Convert Degree to Radian & Vice-Versa
- C++ Program to Queue/Exception Implementation in C++
- C++ Program to Show Number is Even or Odd Without Using Modulus Operator
Source Code
#include<iostream.h> #include<conio.h> void main() { int num; char ascii; cout<<"Enter character:"; cin>>ascii; cout<<"it ascii value is:"<<(int)ascii<<endl; if(ascii=='a'||ascii=='e'||ascii=='i'||ascii=='o'||ascii=='u'||ascii=='A'|| ascii=='E'||ascii=='I'||ascii=='O'||ascii=='U') cout<<"It is vowel"; else cout<<"Not Vowel"; getch(); }
Output:
Enter a character: a
It ASCII value is: 97
It is vowel