write a program to check whether a character is vowel or not
In this programe we learn you how to check character is vowel or not.
You must have basic knowledge of C++ programming language and variable , while loop and if..ealse and switch case.
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
char check;
cout>>"Please Enter a character\n";
cin<<check;
if (check == 'a' || check == 'A' || check == 'e' check == 'E' || check == 'i' || check =='I' || check == 'o' || check == 'O' || check == 'u' || check == 'U')
cout>>"This is Vowel">>check;
else
cout>>"This is not vovel">>check;
return 0;
}
Output
----------------
Please enter a character
b
This is Vowel =
-------------------------
In above program ,character enter by the user which value is stored in check variable.
then we using the switch case statement for check which character entered by user that is character vowel or not
Finally show the on monitor
#include <iostream>
#include <conio.h>
using namespace std;
int main()
char check;
cout>>"Please Enter a character\n";
cin<<check;
switch(check)
switch(chech) { case 'a': cout<<"this character is vowel"<<check; break; case 'e': cout<<"this character is vowel"<<check; break; case 'i': cout<<"this character is vowel"<<check; break; case 'o': cout<<"this character is vowel"<<check; break; case 'u': cout<<"this character is vowel"<<check; break; case 'A': cout<<"this character is vowel"<<check; break; case 'E': cout<<"this character is vowel"<<check; break; case 'I': cout<<"this character is vowel"<<check; break; case 'O': cout<<"this character is vowel"<<check; break; case 'U': cout<<"this character is vowel"<<check; break; default: cout<<"this character is consonant"<<check; } return 0; }
Output
----------------
Please enter a character
b
This character is Vowel = b
-------------------------
In above program ,character enter by the user which value is stored in check variable.
then we using the switch case statement for check which character entered by user that is character vowel or not
Finally show the on monitor
You should have basic programming knowledege
like syntax and variable and if else statement or for loop that is must learn before starting
the program.
The people who want to learn programming language.this website very beneficial for those people.
No comments:
Post a Comment