C++ Program to Count Number of Vowel in a String.

The Program will count the numbers of vowels in a given string. There could be many solutions of this program but we used the most easy and efficient method.

Source Code  

#include<iostream> 
#include<stdio.h> 
using namespace std;
int main() 
{ 
char story [80];
int vowel = 0;
cout<<" \t \t \t Enter Your Story Below \n \n ";
gets(story);
for(int i=0;story[i]!='\0';i++)
{
 if ((story[i] == 'a') ||(story[i] == 'e') ||(story[i]=='i')|| (story[i]=='o') ||(story[i]=='u'))
 {
  vowel++;
}
}
cout<<endl;
cout<<" Your Story Contain "<<vowel<<" Vowels"; 
}

Output of the Program

Count Number of Vowel in a String.



Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment