Back to Problem Solutions forum
I am having issues with this problem. It appears that both my program and I can count the same number of vowels, but I always get it wrong. It also said that there are "little latin letters" in there but in the input text, there are all regular letters. I don't know what is wrong.
// Sorry, I removed the code from here to avoid spoiling solution, Admin :)
Hi! Thanks for your message!
See, your solution is less or more correct except one thing: it processes exactly 100
symbols in input
string notwithstanding the real length of the line you have read.
So if we use example like this:
2
aaaaaaa
oo
It will give correct result 7
for the first line, but then it will read the second one in the same array,
effectively feeling first two elements with letters, then adding carriage return and line terminator (\0
).
I.e. there will remain 3
letters a
from the end of the previous line. And since you process 100
characters you will count them also :)
So you have two ways:
line
variable after processing (which is clumsy);100
but instead up to strlen(line)
- you will need to add
another header file to make this function visible.By the way thanks for pointing out about clumsy wording "could contain little latin letters" - I'll try to fix it now :)
And also I think the if ... > 127
case is not necessary at all and could be safely removed.
Thank you so much for your reply! I feel so much better now that it was me just overlooking the simplest thing!
I got it to work now! Thank you again! I love this website:)
You're welcome:) Haha, when I read "little latin letters" I was thinking that there was something that was hidden in the input text that I just couldn't see, so that's where the "if ... > 127" came from so that it captures the latin characters (even though some of them were not vowels, I was getting desparate at that point).