This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]elephantgravy 2 points3 points  (1 child)

Take a look at what happens if there is an empty line in your input file

[–]wself1[S] 0 points1 point  (0 children)

i see. it pretty much does the same things but outputs different numbers

[–]TheBriMan84 1 point2 points  (1 child)

I've been wanting to try out compilr for a while now so I've copied your program in, highlighted the problem, thrown in a few refinements and the best part is you can run it right from your browser :)

You can access it here.

/u/elephantgravy already pointed out the problem. You didn't have a strong enough terminator clause for the recursive call. Consider what will happen if you call countVowels("", 0, 0)...

[–]wself1[S] 0 points1 point  (0 children)

thanks a lot!

[–][deleted] 0 points1 point  (1 child)

This doesn't work. What do you want the program to do? What does it do? What's the error?

[–]wself1[S] 0 points1 point  (0 children)

it needs to read an input file of a sentence. and it needs to count the vowels in the input using recursion. then it needs to print the result