Program not outputting when if statement is met

Oct 26, 2008 at 1:52pm
figured it out, thanks for the help
Last edited on Oct 26, 2008 at 11:57pm
Oct 26, 2008 at 3:35pm
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 Oct 26, 2008 at 3:40pm
Oct 26, 2008 at 5:06pm
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
Oct 26, 2008 at 7:07pm
you have posted this question before and i tought you got an answer?
Oct 26, 2008 at 11:57pm
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
Oct 27, 2008 at 2:18pm
What happened to the question?
Why did you remove it?
Topic archived. No new replies allowed.