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

Recommended Answers

All 6 Replies

Try looking here

commented: Works for me :) +18

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.

.............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.

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();
}
commented: There are many who can give this. But they didn't, for a reason. See their comments. +0

sentence may not end with \0 .

could you explain?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.