Hello,
I am trying to fix a code that does various statistics on an imported txt file (words are imported and stored in a string). and one those stats that i am having a trouble to get it working is to count the number of words in the txt file that does not contain the letters (a,e,i,o,u or y).
Here is the part of my code that i having a trouble with:
1 2 3 4 5 6 7 8 9
|
while (!wordfile.eof())
{
for ( int k = 0; k < word.length(); k++)
{
if (word [k] != 'a' && word [k] != 'e' && word [k] != 'i' && word [k] != 'o' && word [k] != 'u' && word [k] != 'y')
noVowels++;
}
wordfile.close();
|
The problem here is that it is displaying the number of letters that are not (a,e,i,o,u,y), while i am trying to make it display the number of words not containing those letters.
Here is another part of the code i am working on that displays the number of words starting with "a", and is working:
1 2
|
if ( word [0] == 'a' )
startA++;
|
Any pointers will be most appreciated.