C++ Program Using Switch Statement





This program is used to check whether the entered character is vowel or not. The input is taken through the character “ch” and if the input matches the switch statement it display’s,” it’s a vowel” else displays, “It’s not a vowel.”

This is a simple program of  C++ using a  switch statement.

#include<iostream.h>

#include<conio.h>

Void main ()

{

Char ch;

Cout<<” \n enter a character:”;

Cin>>ch;

Switch (ch)

{

Case ‘A’:

Case ‘a’: cout<<”\n it’s a vowel”;

Break;

Case ‘E’:

Case’e’:: cout<<”\n it’s a vowel”;

Break;

Case ‘I’:

Case’i’: cout<<”\n it’s a vowel”;

Break;

Case ‘o’:

Case ‘O’:: cout<<”\n it’s a vowel”;

Break;

Case ‘u’:

Case’U’: cout<<”\n it’s a vowel”;

Break;

Default: cout<<”\n it’s is not a vowel”;

}

getch ();

}



Related posts:

  1. Switch Statement In C++ Switch statement in c++ C++ provides a multi way decision...
  2. If Else Statement In C++ If else statement in c++ Its general form is:- If...
  3. C++ Program to Input and Output String This is a simple program which is designed  to take...
  4. If Statements In C++ If statements in c++ It is used to test the...
  5. Manipulators In C++ Manipulators Manipulators are operators used with the insertion operator <<...