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?
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.