Check your answer to a C++ Primer exercise against a reference implementation when you get stuck.
Study how C++11 and C++14 features like lambdas, move semantics, and templates are used correctly in practice.
Compile and run individual exercise solutions to see the expected output and understand the intended behavior.
Each file must be compiled with C++14 support: use -std=c++14 on Linux or -std=c++1y on macOS.
This repository is a collection of worked answers to the exercises in C++ Primer, 5th Edition, a widely used textbook for learning the C++ programming language. The solutions cover the modern C++11 and C++14 standards that the book's 5th edition introduced. The repository is organized to match the book's chapter structure. It runs from Chapter 1 (Getting Started) through all four major parts of the book: the basics of variables, strings, functions, and classes, the standard C++ library including containers and algorithms, tools for building reusable classes, and advanced topics such as templates and specialized library features. In total, answers are available across all 19 chapters. Each exercise solution is stored as a C++ source file you can compile and run yourself. The README lists the compilers the author recommends: Visual Studio 2015 or later on Windows, g++ 5.0 or later on Linux, and Clang 3.7 or later on macOS. Each file needs to be compiled with a C++14 flag, such as -std=c++14 on Linux or -std=c++1y on macOS. The repository is licensed under CC0, which means the code has been placed in the public domain and you can use it for any purpose without restriction. If you are working through C++ Primer and get stuck on an exercise, this is a reference to compare your approach against. The solutions were contributed over time by the repository owner and others, and some chapters may have fuller coverage than others. There is also a linked Chinese-language discussion group for readers who prefer that.
← mooophy on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.