S
siddhartha.chadha
I wanted to write a code to calculate the number of words containing
vowels in a given set....if you find the error please reply at
(e-mail address removed)
# include <iostream>
using namespace std;
int main ()
{
char input;
float vowel = 0; float words = -1;
float percent;
for ( ; cin >> input ; )
{ //if ( input == '.' ) {break;}
//if ( input == ' ') { words ++; continue ;}
if ( input == 'a' || input == 'e' || input == 'i' || input == 'o'
|| input =='u')
{ vowel ++; }
if ( input == '.') {break;}
if ( input != 'a' || input != 'e' || input != 'i' || input !=
'o' || input !='u')
{ continue; }
}
cout << words << " " << vowel ;
percent = (vowel/words) * 100;
cout << endl <<percent;
int i ;
cin >> i;
return 0;
}
vowels in a given set....if you find the error please reply at
(e-mail address removed)
# include <iostream>
using namespace std;
int main ()
{
char input;
float vowel = 0; float words = -1;
float percent;
for ( ; cin >> input ; )
{ //if ( input == '.' ) {break;}
//if ( input == ' ') { words ++; continue ;}
if ( input == 'a' || input == 'e' || input == 'i' || input == 'o'
|| input =='u')
{ vowel ++; }
if ( input == '.') {break;}
if ( input != 'a' || input != 'e' || input != 'i' || input !=
'o' || input !='u')
{ continue; }
}
cout << words << " " << vowel ;
percent = (vowel/words) * 100;
cout << endl <<percent;
int i ;
cin >> i;
return 0;
}