Author: Yassir El Yasini
This repository contains a comprehensive collection of C++ programming exercises organized into modules (CPP00 through CPP09). Each module focuses on specific C++ concepts, progressing from basic syntax to advanced features like templates, STL containers, and design patterns.
These exercises are designed to build a strong foundation in C++ programming, covering object-oriented programming, memory management, operator overloading, inheritance, polymorphism, and more.
CPP_MODELS/
├── cpp00/ # Introduction to C++ basics
├── cpp01/ # Memory allocation, references, pointers
├── cpp02/ # Ad-hoc polymorphism, operator overloading
├── cpp03/ # Inheritance
├── cpp04/ # Subtype polymorphism, abstract classes, interfaces
├── cpp05/ # Repetition and exceptions
├── cpp06/ # C++ casts
├── cpp07/ # C++ templates
├── cpp08/ # Templated containers, iterators, algorithms
└── cpp09/ # STL
- ex00: Megaphone - String manipulation and output
- ex01: PhoneBook - Classes, objects, arrays, and basic I/O
- ex00: BraiiiiiiinnnzzzZ - Heap vs Stack allocation
- ex01: Moar BraiiiiiiinnnzzzZ - Array allocation
- ex02: HI THIS IS BRAIN - References and pointers
- ex03: Unnecessary Violence - References in classes
- ex04: Sed is for losers - File manipulation and string replacement
- ex05: Harl 2.0 - Pointers to member functions
- ex06: Harl filter - Switch statements
- ex00: Fixed-point number class - Basic canonical form
- ex01: Towards a more useful fixed-point - Constructor overloading
- ex02: Now we're talking - Operator overloading
- ex03: BSP - Binary Space Partitioning (Point in triangle)
- ex00: ClapTrap - Basic class implementation
- ex01: ScavTrap - Single inheritance
- ex02: FragTrap - Multiple inherited classes
- ex00: Animal class - Basic polymorphism
- ex01: Brain class - Deep copy
- ex02: Abstract class - Pure virtual functions
- ex03: Interface & recap - Materia system
- ex00: Bureaucrat class - Exception handling basics
- ex01: Form class - More exceptions
- ex02: Concrete forms - Inheritance with exceptions
- ex03: Intern class - Dynamic form creation
- ex00: Scalar type conversion
- ex01: Serialization
- ex02: Identify real type
- ex00: Function templates - Basic templates
- ex01: Iter - Template functions with arrays
- ex02: Array class template - Generic array implementation
- ex00: Easy find - Template algorithm
- ex01: Span - Container manipulation
- ex02: Mutated abomination - Stack container adapter
- ex00: Bitcoin exchange - Map container
- ex01: Reverse Polish Notation - Stack container
- ex02: PmergeMe - Merge-insert sort with containers
Each exercise contains a Makefile with the following rules:
make- Compiles the programmake clean- Removes object filesmake fclean- Removes object files and executablemake re- Recompiles the entire project
All projects are compiled with:
c++ -Wall -Wextra -Werror -std=c++98
# Navigate to any exercise directory
cd cpp00/ex00
# Compile the program
make
# Run the executable
./megaphone "shhhhh... I think the students are asleep..."
# Clean up
make fclean- Memory Management: Understanding stack vs heap, proper resource management
- Object-Oriented Programming: Classes, encapsulation, inheritance, polymorphism
- Operator Overloading: Implementing custom operators for classes
- Exception Handling: Using try-catch blocks and throwing exceptions
- Templates: Generic programming with function and class templates
- STL: Working with Standard Template Library containers and algorithms
- Design Patterns: Implementing common patterns in C++
- C++98 Standard: Adhering to older C++ standards and best practices
All exercises strictly adhere to the C++98 standard, which means:
- No C++11 (or later) features
- No
auto,nullptr, range-based for loops, or lambda functions - Traditional memory management (no smart pointers from C++11)
- Standard Template Library in its C++98 form
This project is part of a C++ curriculum and is intended for educational purposes.
Created by Yassir El Yasini | 2026