Thursday, 5 February 2015

Count Number of Vowel in a String.

Structure of the Problem Requirements

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 it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment