Skip to content

yssrexe/CPP_MODELS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

142 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C++ Modules (CPP 00-09)

Author: Yassir El Yasini

📚 Overview

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.

🗂️ Project Structure

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

📖 Module Descriptions

CPP Module 00 - Basics of C++

  • ex00: Megaphone - String manipulation and output
  • ex01: PhoneBook - Classes, objects, arrays, and basic I/O

CPP Module 01 - Memory, Pointers, References

  • 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

CPP Module 02 - Ad-hoc Polymorphism & Orthodox Canonical Class Form

  • 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)

CPP Module 03 - Inheritance

  • ex00: ClapTrap - Basic class implementation
  • ex01: ScavTrap - Single inheritance
  • ex02: FragTrap - Multiple inherited classes

CPP Module 04 - Polymorphism & Abstract Classes

  • ex00: Animal class - Basic polymorphism
  • ex01: Brain class - Deep copy
  • ex02: Abstract class - Pure virtual functions
  • ex03: Interface & recap - Materia system

CPP Module 05 - Exceptions

  • ex00: Bureaucrat class - Exception handling basics
  • ex01: Form class - More exceptions
  • ex02: Concrete forms - Inheritance with exceptions
  • ex03: Intern class - Dynamic form creation

CPP Module 06 - C++ Casts

  • ex00: Scalar type conversion
  • ex01: Serialization
  • ex02: Identify real type

CPP Module 07 - Templates

  • ex00: Function templates - Basic templates
  • ex01: Iter - Template functions with arrays
  • ex02: Array class template - Generic array implementation

CPP Module 08 - Templated Containers

  • ex00: Easy find - Template algorithm
  • ex01: Span - Container manipulation
  • ex02: Mutated abomination - Stack container adapter

CPP Module 09 - STL

  • ex00: Bitcoin exchange - Map container
  • ex01: Reverse Polish Notation - Stack container
  • ex02: PmergeMe - Merge-insert sort with containers

🛠️ Compilation

Each exercise contains a Makefile with the following rules:

  • make - Compiles the program
  • make clean - Removes object files
  • make fclean - Removes object files and executable
  • make re - Recompiles the entire project

Compilation Flags

All projects are compiled with:

c++ -Wall -Wextra -Werror -std=c++98

Example Usage

# 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

📝 Key Learning Objectives

  • 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

🎯 C++98 Standard Compliance

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

📚 Resources

📄 License

This project is part of a C++ curriculum and is intended for educational purposes.


Created by Yassir El Yasini | 2026

About

omplete C++ curriculum covering fundamentals to advanced concepts (C++98 standard)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors