Program to Check Whether a character is Vowel or Consonant.

Definition:- 

Vowel:- A speech sound which is produced by comparatively open configuration of the vocal tract, with vibration of the vocal cords but without audible friction, and which is a unit of the sound system of a language that forms the nucleus of a syllable.A letter representing a vowel sound, such as A, E, I, O, U.

Consonent:-A basic speech sound in which the breath is at least partly obstructed and which can be combined with a vowel to form a syllable.
The 21 consonant letters in the English alphabet are B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V,W,X,Y, Z.


Program:-

#include <iostream.h>
#include<conio.h>

void main()
{
clrscr();
    char c;
    int isLowercaseVowel, isUppercaseVowel;

    cout << "Enter an alphabet: ";
    cin >> c;

    // evaluates to 1 (true) if c is a lowercase vowel
    isLowercaseVowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');

    // evaluates to 1 (true) if c is an uppercase vowel
    isUppercaseVowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');

    // evaluates to 1 (true) if either isLowercaseVowel or isUppercaseVowel is true
    if (isLowercaseVowel || isUppercaseVowel)
        cout << c << " is a vowel.";
    else
        cout << c << " is a consonant.";

getch();
}

Output:-
OUTPUT!!!!!

Post a Comment

0 Comments