Fog Creek Software
Discussion Board

Programming puzzles book in C++

A son of a friend of mine is now getting his toes wet in programming - he's learning C++ for his first language. He is also a puzzle fanatic. Wanting to encourage both behaviors, I was wondering if anyone could recommend a good book on puzzles that can be solved using C++? One that progresses from simple to more complex puzzles, along with solutions and an explanation of those solutions, would be absolutely perfect.

Please only include books that deal with C++ or C, as this is to both entertain and sharpen his emerging programming abilities in these languages. Also, websites as an alternative to books would be welcome also.

Wayne Earl
Thursday, June 5, 2003

Puzzles != C++

I kind of doubt you'll find both of these subjects in a single book as they're both very specific... and not really related.

You may want to search for books that contain brain teasers, or other types of puzzles. Then challenge him to use the C++ code that he's learning to run/solve the puzzles.

Thursday, June 5, 2003

These are Herb Sutter's Guru of the Week columns, all designed as puzzles for C++ developers.  Some of them are collected in his books "Exceptional C++" and "More Exceptional C++".

Ben Combee
Thursday, June 5, 2003

Hey KoolAid -
What makes you think you can't do puzzles in C++? Many classic programming problems are puzzles.

"The Tower of Hanoi" is generally used to teach recursion...


Thursday, June 5, 2003


  Herb Sutter (and Andrei Alexandrescu) are a little out of the league for a kid trying on C++ as their first language.  Those authors should come after Scott Meyers.  Besides, Herb's puzzles are *about* C++'s particular quirks.

  This kid should probably start with Dr. Ecco puzzles or books recommended at Fog Creek's own TechInterview site.

David Blume
Thursday, June 5, 2003

Programming Pearls.

Basically a set of tricky problems, with the solutions.

Thursday, June 5, 2003

I don't know about C++ puzzle books but you should look at for puzzles that you can hack up in no time. It's great for learning how to code in a language you are not familiar with. 

Tom Vu
Thursday, June 5, 2003

Three books:

1. Obfuscated C and Other Mysteries

Essential C information, shocking code mysteries and endless hours of amusement and perplexity.

2. The C Puzzle Book

Oh man, out of print for years and it was such a good one.

3. Programming Pearls.

Fits the bill but not as humorous as the others. Does have puzzle/exercises in each chapter, many of which are quite challenging.


As far as C++ goes, just dig up some const-correct templating code with complete and robust exception handling.

X. J. Scott
Friday, June 6, 2003

Puzzled Programmers: 15 Mind-Boggling Story 
Puzzles to Test Your Programming Prowess:
Solutions in Basic, Pascal, and C

Dated, but good.  Also the Dr. Ecco series.

Synder (OFRPGT)
Friday, June 6, 2003

My other half got a book entitled "How Not To Program in C++: 111 Broken Programs and 3 Working ones"

Which was brilliant. Which is strange because it's basically the bits of programming job interviews I hate.

Katie Lucas
Friday, June 6, 2003


I didn't say you can't do puzzles in C++. I said that they are not the same thing (!=), and it may be hard to find a book that is about both specifically. That's all.

Friday, June 6, 2003

*  Recent Topics

*  Fog Creek Home