Calculating number of consonants and vowels

Here is a program to find the number of consonants and vowels in the the alphabets entered by the user.

[sourcecode language=’cpp’]
#include
#include
void main()
{
char ch;
int n;
int v=0,c=0;
cin>>n;
for(int i=0;i>ch;
if(isdigit(ch)){
cout<<"Enter an alphabet"; } if(isupper(ch)) ch=tolower(ch); if ((ch=='a')||(ch=='e')||(ch=='i')||(ch=='o')||(ch=='u')) { v++; } else c++; } cout<<"Number of Vowels = "<

Share this: