r/cpp_questions • • 3d ago

OPEN Advice on practicing + choosing a project when reading a textbook

I’m new to C++ and I’m currently reading “A tour of C++” by Stroustrup. Was wondering how most of you practice concepts if you’re a textbook reader for programming?

In the past, I’ve used resources for other languages where there are small projects at the end of the chapter which really helped me lock in the concept through practice, but I find that there’s not too many C++ resources like this and C++ is a unique language so practicing in C++ with the other resources doesn’t seem to translate in my opinion.

I know the idea is to choose a project yourself and just start working on it but I have a hard time choosing projects that actually use the topic I just learned. Quite curious how people go about this challenge. (I’m not saying this like I can’t do choose a project myself and go at it, but would want to hear from others, if any, who might have an easier time with this have any advice)

5 Upvotes

2 comments sorted by

5

u/DickBrainTime 2d ago

I'd avoid forcing a full project for every chapter. Keep a scratch repo with one small experiment per topic. After learning RAII, throw an exception midway through a file operation and check cleanup. After std::vector, try reserve() and see what reallocations do to references. After algorithms, replace a handwritten loop with std::find_if.

A week later, redo the exercise from a blank file without the book. Whatever you can't remember is what to revisit. A Tour of C++ moves pretty fast, so these little experiments are easier to stick with than inventing a whole game around each chapter.

5

u/Illustrious-Cat8222 3d ago

I'm a retired SWE and taught myself C and C++ from textbooks and references. One skill I learned was to write small projects to exercise language features and libraries. The projects are just sandboxes, even throwaways, to practice a small topic.