C++ Program to Input Character and Display Vowel or Not

Input Character and Display Vowel or Not

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

TutsMaster.org

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.