This repository contains a collection of C++ code examples, organized by topic, to help beginners learn the language.
- Basics - Fundamental C++ concepts.
- Intermediate - Covers STL containers, OOP, memory management, file I/O, and more. See the Intermediate README for a detailed list of examples.
- Advanced - Explores templates, STL algorithms, exception safety, RAII, move semantics, concurrency, and modern C++ features. See the Advanced README for a detailed list.
- C++ in Data Science - Examples for numerical libraries (Eigen), custom data handlers (CSV), and performance considerations. See the Data Science README for details.
- NVIDIA CUDA C++ - Introductory examples to CUDA C++ for GPU programming. Requires NVIDIA GPU & CUDA Toolkit. See the CUDA README for setup and details.
- A C++ compiler (e.g., g++, clang++) for general C++ examples.
- NVIDIA CUDA Toolkit (including
nvcc) and a CUDA-enabled NVIDIA GPU for CUDA examples. - make (optional, for using a Makefile if provided in specific examples).
Most general C++ examples in this repository are single .cpp files and can be compiled using a standard C++ compiler. For example:
g++ cpp/01-basics/01-hello-world.cpp -o hello_world
./hello_worldCUDA C++ examples (.cu files) must be compiled with nvcc (NVIDIA's CUDA compiler). For example:
nvcc cpp/05-cuda/01-cuda-device-query.cu -o device_query
./device_queryAlways refer to the readme.md file within each specific section (e.g., cpp/05-cuda/readme.md) for detailed prerequisites and compilation instructions relevant to those examples.
For more complex examples or projects, a Makefile might be provided. In such cases, navigate to the example's directory and run make.
(To be defined)
(To be defined)