6
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by niyasc
0

first let the user enter the string. then find out the no. of characters in that string. better if u store that string in array.now run the loop and compare each character with a,e,i,.o,u.if it is same increment the value of counter variable by 1 else not.

0

.............The question was pretty straightforward, yes. But we aren't those answer givers, or books that you can use to get answers:@, if you really do want a answer though, check this out, it helps alot.

-2

Hi guys,
I do need a c++ programm which may
"Count vowels in monosyllabic,two syllable and longer words within a string/sentence"
bye.

in tc

#include<iostream.h>
#include<conio.h>
void main()
{
char sent[100];
cout<<"Enter a sentence\n";
cin.getline(sent,100);
int counter=0,i=0;
while(sent[i]!='\0')
{
if(sent[i]=='a'||sent[i]=='e'||sent[i]=='i'||sent[i]=='o'||sent[i]=='u')
{
counter++;
}
i++;
}
cout<<"Number of vowels="<<conter+1;
getch();
}

Edited by Nick Evan: Added code-tags

Votes + Comments
There are many who can give this. But they didn't, for a reason. See their comments.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.