C++ is not a straightforward programming language to learn, especially without prior programming experience. It has been described as a "federation" of languages and contains a wealth of features. There is no single book that can hope to teach C++ in its entirety. Instead, multiple approaches are required to gain a full understanding of the language. QuantStart has listed five books which will provide a solid grounding in C++ development principles - some of which are specifically geared towards quantitative finance.
Teach Yourself C++ in 24 Hours is now in its 5th Edition, so the book has clearly had some success, and this edition covers the new C++0x standard. Liberty and Cadenhead have written a book for complete beginners to C++, if not programming itself. It begins with the basics of compilation, then introduces variables, expressions, functions, program flow, arrays and strings. For programmers with experience in other languages, this is a useful section to see how the basics are carried out in C++. The next section begins by discussing object orientation (C++ classes), memory management and inheritance/polymorphism. The remainder of the book looks at templates and exception handling.
One minor criticism of the book concerns its prediction of "one hour a day". Although great for marketing material, it is somewhat underestimating the time required for beginners to understand each topic. Hence, be prepared to spend a couple of hours on each section, with multiple read-throughs if necessary. The authors provide guidance on setting up the DJGPP compiler, as well as with Microsoft Visual C++, which is likely to be a quant's main Interactive Development Environment (IDE).
I recommend this book for the beginner programmer, but for a quant interview (and subsequent role!) the remainder of the books on this list constitute a minimum of the knowledge required.
Schildt's C++: A Beginner's Guide covers similar material to Liberty and Cadenhead's book above. However, it goes into a lot more detail with particular areas. Thus it is often considered a good companion text. The appendices are useful. It contains an appendix on the pre-processor, which is a topic not often discussed in beginner books, as well as another on working with older compilers, which some quants may encounter in firms with legacy systems.
The book is definitely a worthwhile addition to Teach Yourself C++ in 24 Hours if you find you require more detail in particular areas.
Accelerated C++ takes a different approach to the two books above. It uses an example-driven approach, so that the beginning C++ student gains familiarity with concepts such as strings and vectors early on. Thus it defers discussion of more abstract topics, such as memory management and inheritance/polymorphism, until the student has grasped these essential basics. The book discusses smart pointers, which is something often omitted from other beginning books, but their benefits are well-known (see Effective C++ below for more detail on this topic).
I recommend Accelerated C++ if you are after a more example-led way of learning C++.
Daniel Duffy's Introduction to C++ for Financial Engineers will be your first serious attempt at implementation of financial models. The book demonstrates the basic aspects of the language first (such as compilation), before quickly describing classes, memory management, operator overloading and inheritance. At each step of the way, Duffy applies these concepts to elements in finance. The book then proceeds to discuss templates, design patterns and data structures and how extensibility and maintainability arise from using these methods. The final section of the book implements a binomial model, a one-factor Black-Scholes finite difference solver, a two-factor options pricer and a Monte Carlo method.
I recommend this book highly for an individual who has been exposed to C++, but is unsure how to begin applying concepts like classes, design patterns, the STL and data structures to a financial setting.
This list would not be complete without mentioning Meyers' classic guide to effective C++ programming. In fact, this book is required reading for most quant developer shops. You will almost certainly be asked questions from this book at a quant/C++ interview, for it contains many subtle "gotchas" that have tricked us all at one time or another.
Meyers provides 55 tips in all of the main areas of C++, including object construction/destruction, resource and memory management, declarations, implementation, inheritance/polymorphism, templates and then new/delete operators. Each "tip" is actually a three/four page discussion regarding difficult aspects of the language. Meyers explains each pitfall clearly and with sufficient depth, never spending too long on one topic.
This book should not only be purchased and read through more than once, it should be well-thumbed at the desk through those long debugging sessions. I highly recommend this book.
I've also added a C++ bookshop to QuantStart, which has many more C++ books than listed here.
You'll get instant access to a free 10-part email course packed with hints and tips to help you get started in quantitative trading!
Every week I'll send you a wrap of all activity on QuantStart so you'll never miss a post again.
Real, actionable quant trading tips with no nonsense.