I'm mostly interested in not only to 'hack' but to understand how computers and programs work and what things make them vulnerable at the first place.

The first thing is (I assume) to learn some programming language, and I'm currently reading C++ Primer (4th.ed.). But what should I read'n'learn after that? I know that programming is not so much about the language but to know how to solve problems. How can I train myself to 'think right' and learn to solve problems effectively?

And what would be good place to start getting familiar with the whole hacking theme? And most of all; what to do to really know what and why computer and programs are doing? There's really no point of 'hacking' if I don't really understand what I'm doing and why I'm doing it...

So, summa summarum: What book and other texts and things would you suggest to wannabe hacker?