A comprehensive collection of C++ programming concepts, examples, and implementations for learning and reference purposes.
This repository contains well-documented C++ code examples covering fundamental to advanced programming concepts. Each topic includes practical implementations with clear explanations to help developers understand and master C++ programming.
cpp-concepts/
βββ basics/ # Fundamental C++ concepts
β βββ variables_datatypes/
β βββ operators/
β βββ control_structures/
β βββ functions/
βββ oop/ # Object-Oriented Programming
β βββ classes_objects/
β βββ inheritance/
β βββ polymorphism/
β βββ encapsulation/
βββ memory_management/ # Pointers, References, Smart Pointers
β βββ pointers/
β βββ references/
β βββ dynamic_allocation/
β βββ smart_pointers/
βββ stl/ # Standard Template Library
β βββ containers/
β βββ iterators/
β βββ algorithms/
β βββ functors/
βββ advanced/ # Advanced Topics
β βββ templates/
β βββ lambda_expressions/
β βββ multithreading/
β βββ move_semantics/
βββ data_structures/ # Common Data Structures
β βββ arrays_vectors/
β βββ linked_lists/
β βββ stacks_queues/
β βββ trees_graphs/
βββ algorithms/ # Algorithm Implementations
β βββ sorting/
β βββ searching/
β βββ graph_algorithms/
β βββ dynamic_programming/
βββ projects/ # Practice Projects
βββ calculator/
βββ file_manager/
βββ mini_games/
- Variables and Data Types
- Operators and Expressions
- Control Flow (if, switch, loops)
- Functions and Parameter Passing
- Arrays and Strings
- Classes and Objects
- Constructors and Destructors
- Inheritance and Access Specifiers
- Polymorphism (Virtual Functions)
- Abstract Classes and Interfaces
- Operator Overloading
- Pointers and Pointer Arithmetic
- References vs Pointers
- Dynamic Memory Allocation
- Smart Pointers (unique_ptr, shared_ptr, weak_ptr)
- Memory Leaks and RAII
- Containers (vector, list, map, set, etc.)
- Iterators and their categories
- Algorithms (sort, find, transform, etc.)
- Function Objects and Lambdas
- Templates and Generic Programming
- Exception Handling
- File I/O Operations
- Multithreading and Concurrency
- Move Semantics and Perfect Forwarding
- Linear Data Structures
- Trees and Graph Structures
- Sorting and Searching Algorithms
- Time and Space Complexity Analysis
- C++ compiler (GCC 7+, Clang 6+, or MSVC 2017+)
- Text editor or IDE (VS Code, CLion, Dev-C++, etc.)
- Basic understanding of programming concepts
Each example can be compiled individually:
# For single file compilation
g++ -std=c++17 -Wall -Wextra filename.cpp -o output
# For files with multiple dependencies
g++ -std=c++17 -Wall -Wextra *.cpp -o output
# With debugging information
g++ -std=c++17 -Wall -Wextra -g filename.cpp -o output# Navigate to specific topic folder
cd basics/variables_datatypes/
# Compile and run
g++ -std=c++17 variables_example.cpp -o variables_example
./variables_example- Browse by Topic: Navigate to folders based on the concept you want to learn
- Read the Code: Each file contains detailed comments explaining the concepts
- Compile and Run: Test the examples to see them in action
- Modify and Experiment: Change the code to better understand the concepts
- Practice: Use the examples as reference for your own projects
Each topic folder contains:
- README.md: Explanation of the concept
- example.cpp: Basic implementation
- advanced_example.cpp: More complex usage
- exercises.cpp: Practice problems (when applicable)
All code examples are written to be compatible with:
- C++11 (minimum standard)
- C++14, C++17, C++20 features marked clearly
- Cross-platform compatibility (Windows, Linux, macOS)
Contributions are welcome! Here's how you can help:
- Add New Concepts: Implement missing C++ topics
- Improve Examples: Make existing code clearer or more efficient
- Fix Issues: Correct bugs or compilation errors
- Add Exercises: Create practice problems for topics
- Documentation: Improve comments and explanations
- Write clean, well-commented code
- Follow consistent naming conventions
- Include practical examples
- Test code before submitting
- Add appropriate README files for new topics
- Basics β Functions β Arrays
- Classes and Objects β Constructors/Destructors
- Basic STL (vector, string)
- Simple Projects
- Inheritance and Polymorphism
- Pointers and References
- STL Containers and Algorithms
- Exception Handling
- File I/O
- Templates and Generic Programming
- Smart Pointers and Memory Management
- Multithreading
- Move Semantics
- Advanced STL usage
- C++ Reference
- C++ Core Guidelines
- Compiler Explorer - Online C++ compiler
- C++ Insights - See what the compiler does
This project is licensed under the MIT License - see the LICENSE file for details.
- C++ community for inspiration and best practices
- Educational institutions and online resources
- Contributors who help improve this repository
Happy Learning! π
This repository is maintained as an educational resource. Feel free to star β if you find it helpful!