View Single Post
Join Date: Oct 2008
Posts: 118
Reputation: chococrack is on a distinguished road 
Solved Threads: 14
chococrack's Avatar
chococrack chococrack is offline Offline
Junior Poster

Re: Trouble with loops - Calculate sum of even and odd integers

 
0
  #2
Oct 6th, 2008
Look at line 13

  1. stop = num;

Now ask yourself, "self, whats stop?"
"a character."
"self, whats num?"
"an integer."

Whats probably going down is that the the char (stop) is being assigned an integer, which in effect is tossing your loop off.

Are you only interested in positive integers? Because then you could ask for a negative value to terminate that list of integers.

  1. while(num != -1)
Last edited by chococrack; Oct 6th, 2008 at 3:54 am.
I would love to change the world, but they won't give me the source code
Reply With Quote