Most elegant way to write a piece of code that handles ramping up and down?

1 : -1; while (newThrottle! = currentThrottle) { // do your stuff currentThrottle += add; }.

This works well. Thanks! – chris12892 Aug 17 '10 at 4:17 Wow you guys are fast.

I only just noticed that. – chris12892 Aug 17 '10 at 4:23 Hmm.. the only issue that I am having is that it doesn't seem to ever get down to zero. For example, if I ask it to ramp up to 40 then later back down again to 0, it doesn't seem to ever hit 0.

Any ideas? – chris12892 Aug 17 '10 at 4:37 @chris: See this: ideone. Com/lU3mP.

You'd have to set the newThrottle = -1 to have the body of the loop executed. – NullUserException? 2 Aug7 at 4:41 I see.

Thanks! I eventually realized what was wrong. – chris12892 Aug 17 '10 at 4:45.

I'd consider doing something like this: int step = newThrottle oldThrottle); I think I'd use the first version though -- at least IMO, it's easier to read and understand. The second also depends on true converting to 1 and false converting to 0.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions