This post has been edited by nickeldog: 27 September 2007 - 11:12 PM
fuctions for finding vowels in last name not working? Why? and What DImaking a function for vowels not working
Page 1 of 1
6 Replies - 1241 Views - Last Post: 28 September 2007 - 06:19 AM
#1
fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 10:05 PM
problem solved thansk j
Replies To: fuctions for finding vowels in last name not working? Why? and What DI
#2
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 10:15 PM
you have WAY too many variables in your function (all the ones with random letter names). all you need is one to contain the total number of vowels, such aas totalVowels. simply increment the variable totalVowels each time a vowel is encountered
and what about "and sometimes y?"
maybe count each "y" as 0.5 vowels?
and you should probably also account for the fact that the user may enter either upper- or lower-case letters.
-jjh
and what about "and sometimes y?"
and you should probably also account for the fact that the user may enter either upper- or lower-case letters.
-jjh
This post has been edited by jjhaag: 27 September 2007 - 10:59 PM
#3
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 10:19 PM
Taking your suggestion I came up with this however it is not incrementing totalVowels, Im sorry for such newbie questions but I hardly could be called a newbie at best.
This post has been edited by nickeldog: 27 September 2007 - 11:12 PM
#4
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 11:05 PM
nickeldog, on 27 Sep, 2007 - 10:19 PM, said:
Taking your suggestion I came up with this however it is not incrementing totalVowels, Im sorry for such newbie questions but I hardly could be called a newbie at best.
this code hasn't been compiled - you return a variable totalVowelsi which hasn't been declared (extra i on the end). when you do compile your entire for loop isn't incrementing at all. stick in a cout << letters statement and see.
your name.size() call is returning zero, so the loop exits before doing anything.
-jjh
#5
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 11:15 PM
jjhaag, on 27 Sep, 2007 - 11:05 PM, said:
nickeldog, on 27 Sep, 2007 - 10:19 PM, said:
Taking your suggestion I came up with this however it is not incrementing totalVowels, Im sorry for such newbie questions but I hardly could be called a newbie at best.
this code hasn't been compiled - you return a variable totalVowelsi which hasn't been declared (extra i on the end). when you do compile your entire for loop isn't incrementing at all. stick in a cout << letters statement and see.
your name.size() call is returning zero, so the loop exits before doing anything.
-jjh
I actually just found the problem before i read this and everything runs smoothly now. Well I never really foudn the problem I just erased it all and typed it all in. Yea i dont know why but it kept adding I to the end of totalvowels after everytime i complied it. It still didnt work atfter I took it off. I guess thats because I had an error in my loop somewhere. No big deal ( well it was because this has total kicked my ass and deprived me of sleep.) but doign it over again must of made me type something in the right way this time.
Thanks ALOT!!!!
#6
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 27 September 2007 - 11:18 PM
nickeldog, on 27 Sep, 2007 - 10:05 PM, said:
problem solved thansk j
oops. you probably want to leave your original post in there so that others can see what was done, and it can help them.
glad it worked out for you.
and post your final code if you can. i have to admit, i didn't really see what the problem with the strings was - all i noticed was the lack of incrementing.
-jjh
This post has been edited by jjhaag: 27 September 2007 - 11:20 PM
#7
Re: fuctions for finding vowels in last name not working? Why? and What DI
Posted 28 September 2007 - 06:19 AM
jjhaag, on 27 Sep, 2007 - 11:18 PM, said:
nickeldog, on 27 Sep, 2007 - 10:05 PM, said:
problem solved thansk j
oops. you probably want to leave your original post in there so that others can see what was done, and it can help them.
glad it worked out for you.
and post your final code if you can. i have to admit, i didn't really see what the problem with the strings was - all i noticed was the lack of incrementing.
-jjh
No problem I ll repost it today after class.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|