Greetings and welcome to cpplings. This project contains small exercises to get you used to reading and writing C++ code. This includes reading and responding to compiler messages!
Alternatively, for a first-time C++ learner, there are several other resources:
- learncpp.com - The most comprehensive resource for learning C++, but a bit theoretical sometimes. You will be using this along with cpplings!
- A Tour of C++, from Bjarne Stroustrup - Learn C++ by solving little exercises! It's almost like
cpplings, but online - The C++ FAQ
- C++ Core guidelines
cpplings got its inspiration from the magnificent rustlings repository, which aims at familiarizing newcomers to the Rust language. This repository is a sort of a fork of it but for the C++ language
Recommend using WSL and follow the Linux steps.
For Ubuntu:
sudo apt install g++ cmake make gdb git libasan8For Fedora
sudo dnf install gcc-c++ cmake make gdb git libasangit clone https://github.com/jaques-sam-tlv/cpplings
cd cpplings
cmake . -B build
cmake --build build [--parallel 8]You should expect the build to fail: your task is to fix each exercise for the build to succeed.
The exercises are sorted by topic and can be found in the subdirectory cpplings/exercises/<topic>. For every topic there is an additional README file with some resources to get you started on the topic. We really recommend that you have a look at them before you start.
The task is simple. Most exercises contain an error that keeps them from compiling, and it's up to you to fix it! Some exercises are also run as tests, but cpplings handles them all the same. To run the exercises in the recommended order, execute:
To run all exercises in predetermined order:
(In the build directory)
makeThis will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers).
OR, to run a specific exercise, tell make with exercise to run. For example:
make variable2Visual Studio will let you choose the specific exercise you would like to solve.
You will find some help for specific exercises in the hints directory. Please note that this is work in progress.
Once you've completed cpplings, put your new knowledge to good use! Continue practicing your C++ skills by building your own projects, contributing to cpplings, or finding other open-source projects to contribute to.
If you'd like to uninstall cpplings, you can do so by simply deleting the cpplings directory.
Now you should be done!
cpplings isn't done and could still be improved.
- More hints
- Structs and Classes
- Better ownership stuff
- Better safer programming, security stuff
- Threads
- Metaprogramming
- ??? probably more
If you are interested in improving or adding new ones, please feel free to contribute!
Contributions of any kind welcome!
The cpplings build system based on CMake and CPM.make for package management