|
-
October 6th, 2014, 06:47 AM
#9
Re: Get the longest sequence in hailstone program
 Originally Posted by iikitty
Code:
for (int count=2, ss=s;ss>1;count++)
Get into the habbit of writing PREincrements (++count) rather than post increments (count++).
The only time you want a post-increment is when you want the exact behaviour the post increment gives you. If you don't know/understand the difference (yet), then use pre-increments.
the same is true for decrements, use --count, unless you specifically want the behaviour of count--.
No I'm not going to explain. Just get into the habbit of doing this. It'll make your life a lot easier learning to do this NOW, rather than weening you off the post-inc/decrement later on.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|