You aren't scanning the next number until after you've already entered the while loop, which is why it's not working. You have a check to see whether the number is positive or negative. Why don't you...
Type: Posts; User: KevinWorkman
You aren't scanning the next number until after you've already entered the while loop, which is why it's not working. You have a check to see whether the number is positive or negative. Why don't you...
"It doesn't work" is one of the least informative statements you can make. What exactly did you try (an SSCCE answers that question). What does it do? What did you expect it to do?
A do-while loop will do something, and then check to see whether it should be repeated.
A while loop will check if something should be done, and if so, do it and repeat the check.
You want to...