Program not outputting when if statement is met

figured it out, thanks for the help
Last edited on
I'm not familiar with stringstreams, I'm looking them up now, but from what I can see, you are passing the current character by value to checker, then setting the vowel variable to 1. The problem with this is that the vowela, vowelb, etc., variables in checker are different than the same variables in main. When the checker function exits, that value gets lost.
So no matter how many times you call checker(), the vowelcount never changes, and will just remain 0. Since the individual vowel variables don't get sent back to main, vowelcount will never be greater than 3.
If you want to change a variable in main{} with a function, you have to pass the variable by reference.
Another thing, in checker, you just set , say, vowela to 1. What happens if you come across another a? In your program, vowela just gets set back to 1, when it should now be 2.
Try incrementing the vowel variables by 1 instead of setting them to 1.
Last edited on
since I am trying to count for different vowels instead of the total number of vowels that's why each vowel only counts once. I'll try the reference for the function and get back to you tonite
you have posted this question before and i tought you got an answer?
i figured out how to get the sentence split using a streamstring, I had some questions on this and wanted to share my code for help, but i worked on it tonight and figured everything out, thanks
What happened to the question?
Why did you remove it?
Topic archived. No new replies allowed.