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
0 comments:
Post a Comment