How long should you spend on a problem when learning C++?


I'm currently stuck on a problem in a C++ book and it's taking me quite a while to figure out.

I was wondering; should you always stick with a problem until you've solved it? Even if it's just for training purposes? Or should you move on or get help from other people after a certain period of time?

I'm just thinking in terms of spending a few hours trying to complete a problem when in those few hours I could have learned something else. I know it's much better to solve all problems you come across, as that's what programming is all about, but what would you suggest I do?

Give it a real good try.

If you are getting nowhere, do something else (perhaps something other than programming), may be have a good night's sleep, and then take a fresh look at the problem once again.

If you are still stuck, try and to get someone to point you in the right direction.
As was said have sleep, and try again. If it do not help you need to ask some one what is the meaning of your error. If here are no errors, but you don't get results you want, try harder. As here aren't better way to learn as to solve problem oneself.

do something else for a little bit or a while then go back to it. That's helped me a lot recently. (not just with programming)
Topic archived. No new replies allowed.