6 Replies - 1376 Views - Last Post: 28 September 2007 - 06:19 AM Rate Topic: -----

#1 nickeldog  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 07

fuctions for finding vowels in last name not working? Why? and What DI

Posted 27 September 2007 - 10:05 PM

problem solved thansk j

This post has been edited by nickeldog: 27 September 2007 - 11:12 PM

Is This A Good Question/Topic? 0
  • +

Replies To: fuctions for finding vowels in last name not working? Why? and What DI

#2 jjhaag  Icon User is offline

  • me editor am smartastic
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,789
  • Joined: 18-September 07

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?" :D 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

This post has been edited by jjhaag: 27 September 2007 - 10:59 PM

Was This Post Helpful? 0
  • +
  • -

#3 nickeldog  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 07

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

Was This Post Helpful? 0
  • +
  • -

#4 jjhaag  Icon User is offline

  • me editor am smartastic
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,789
  • Joined: 18-September 07

Re: fuctions for finding vowels in last name not working? Why? and What DI

Posted 27 September 2007 - 11:05 PM

View Postnickeldog, 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
Was This Post Helpful? 0
  • +
  • -

#5 nickeldog  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 07

Re: fuctions for finding vowels in last name not working? Why? and What DI

Posted 27 September 2007 - 11:15 PM

View Postjjhaag, on 27 Sep, 2007 - 11:05 PM, said:

View Postnickeldog, 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!!!!
Was This Post Helpful? 0
  • +
  • -

#6 jjhaag  Icon User is offline

  • me editor am smartastic
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,789
  • Joined: 18-September 07

Re: fuctions for finding vowels in last name not working? Why? and What DI

Posted 27 September 2007 - 11:18 PM

View Postnickeldog, 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

Was This Post Helpful? 0
  • +
  • -

#7 nickeldog  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 27-September 07

Re: fuctions for finding vowels in last name not working? Why? and What DI

Posted 28 September 2007 - 06:19 AM

View Postjjhaag, on 27 Sep, 2007 - 11:18 PM, said:

View Postnickeldog, 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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1