[Tutor] while and for

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 9 Oct 2000 19:52:32 -0700 (PDT)


On Mon, 9 Oct 2000 CMNOLEN@aol.com wrote:

> 'You have entered 3 numbers totaling 45.'  or
> 'The total is 45. You have entered 3 numbers.'

Another hint: try to to write your program so it's _almost_ right: have it
keep summing totals until the user enters zero.  After you get that
working, it shouldn't be too bad to have it print a running count as well.  
This is the "I'm faking it now, but I'll fix it soon" method.  *grin*

The faking method actually works pretty well --- you know exactly what
your program isn't supposed to do yet, and you'll get a running program
that you can improve on until things finally do work.


> And I really do appreciate your help! By the way do you have any
> favorite books for a beginning programmer? Thank You! cmn

Ah!  A reading list!

I'd highly recommend George Polya's "How to Solve It".  It's a wonderful
book that explains a "heuristic" way of approaching problems.  Although
Polya does it with math, it's not too much of a stretch to apply his tips
to computer programming.  I think that every programmer should be familiar
with it.

Another classic is Jon Bentley's "Programming Pearls", but you might want
to wait on that one until you're more comfortable with programming.  
Which reminds me; I must finish reading it too!  *grin*

Finally, you might want to look at Douglas Hofstadter's "Godel, Escher,
Bach" for recreational, mind-bending reading.  It has been described as a
"philosophy book disguised as a CS book disguised as literature".  It's
very good.


Good luck!