{"id":15047224,"url":"https://github.com/aaron-22766/42_cpp","last_synced_at":"2026-02-12T19:03:43.756Z","repository":{"id":193492761,"uuid":"664969216","full_name":"aaron-22766/42_CPP","owner":"aaron-22766","description":"Collection of modules for learning object-oriented programming and everything C++","archived":false,"fork":false,"pushed_at":"2024-02-22T12:09:51.000Z","size":451,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T22:47:20.584Z","etag":null,"topics":["42","42-cpp-modules","42born2code","42cursus","42heilbronn","42projects","42school","cpp","cpp98","object-oriented-programming"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaron-22766.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-07-11T06:42:31.000Z","updated_at":"2024-02-14T11:18:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"efda3f6e-4036-4b27-b27f-aecbef683b17","html_url":"https://github.com/aaron-22766/42_CPP","commit_stats":null,"previous_names":["aaron-22766/42_cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aaron-22766/42_CPP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaron-22766%2F42_CPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaron-22766%2F42_CPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaron-22766%2F42_CPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaron-22766%2F42_CPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaron-22766","download_url":"https://codeload.github.com/aaron-22766/42_CPP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaron-22766%2F42_CPP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29377923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T18:59:55.292Z","status":"ssl_error","status_checked_at":"2026-02-12T18:59:44.289Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42","42-cpp-modules","42born2code","42cursus","42heilbronn","42projects","42school","cpp","cpp98","object-oriented-programming"],"created_at":"2024-09-24T20:55:16.049Z","updated_at":"2026-02-12T19:03:43.741Z","avatar_url":"https://github.com/aaron-22766.png","language":"C++","readme":"\u003ch1 align=\"center\"\u003e\n\t\u003cp\u003e\n\tC++ Modules\n\t\u003c/p\u003e\n\t\u003cimg src=\"https://github.com/aaron-22766/aaron-22766/blob/main/42-badges/cppe.png\"\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cb\u003e\u003ci\u003eC \"enhanced, enhanced\"\u003c/i\u003e\u003c/b\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/aaron-22766/42_cpp?color=lightblue\" /\u003e\n\t\u003cimg alt=\"Code language count\" src=\"https://img.shields.io/github/languages/count/aaron-22766/42_cpp?color=yellow\" /\u003e\n\t\u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/aaron-22766/42_cpp?color=blue\" /\u003e\n\t\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/aaron-22766/42_cpp?color=green\" /\u003e\n\u003c/p\u003e\n\n---\n\n## 📯 General info\n\n* We have to use C++98 and compile with the `-std=c++98` flag (be careful, the macOS `c++` compiler sometimes doesn't warns you if you're using newer features, so make sure to compile on Linux to be safe)\n* No norm 🥳\n* Class names must be in UpperCamelCase format. Files containing class code will always be named according to the class name.\n* You are allowed to use almost everything from the standard library. Thus, instead of sticking to what you already know, it would be smart to use as much as possible the C++-ish versions of the C functions you are used to.\n* Forbidden: `Boost` libraries, `*printf()`, `*alloc()`, `free()`, `using namespace \u003cns_name\u003e` (but `using \u003cnamespace\u003e::\u003cclass\u003e` is allowed), `friend` keyword\n* **Containers** and **Algorithms** (`\u003calgorithm\u003e` header) are only allowed in Module 08 and 09\n* Avoid memory leaks\n* From Module 02 to 09, your classes must be designed in the **Orthodox Canonical Form**, except when explicitely stated otherwise\n* No function implementation in a header file\n* Headers must have **include guards**\n\n### Jump to module\n\n- [CPP 00](#cpp-00)\n- [CPP 01](#cpp-01)\n- [CPP 02](#cpp-02)\n- [CPP 03](#cpp-03)\n- [CPP 04](#cpp-04)\n- [CPP 05](#cpp-05)\n- [CPP 06](#cpp-06)\n- [CPP 07](#cpp-07)\n- [CPP 08](#cpp-08)\n- [CPP 09](#cpp-09)\n\n## CPP 00\n\n\u003e Namespaces, classes, member functions, stdio streams, initialization lists, static, const, and some other basic stuff\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Megaphone** | \u003cul\u003e\u003cli\u003ePrint the arguments in upper-case\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhat's a namespace\u003c/li\u003e\u003cli\u003e`std::string`\u003c/li\u003e\u003cli\u003eprinting with `std::cout`\u003c/li\u003e\u003cli\u003e`for` loop\u003c/li\u003e\u003c/ul\u003e |\n| **01: My Awesome PhoneBook** | \u003cul\u003e\u003cli\u003ePhoneBook class with 8 Contacts that can ADD, SEARCH and EXIT\u003c/li\u003e\u003cli\u003eA Contact has: first name, last name, nickname, phone number, and darkest secret\u003c/li\u003e\u003cli\u003eADD: prompts the user for Contact fields and it gets saved in the phonebook\u003c/li\u003e\u003cli\u003eSEARCH: display a list of all contact names with indexes, prompt for an index to print the corresponding contact\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eclass syntax\u003c/li\u003e\u003cli\u003e`public` and `private` variables/methods\u003c/li\u003e\u003cli\u003e`static` functions\u003c/li\u003e\u003cli\u003econstructor and destructor\u003c/li\u003e\u003cli\u003eoperator `\u003c\u003c` overloading\u003c/li\u003e\u003cli\u003edefault function arguments\u003c/li\u003e\u003cli\u003ereading a line from stdin using `std::getline`\u003c/li\u003e\u003cli\u003e`do while` loop\u003c/li\u003e\u003cli\u003emore `std::string` methods\u003c/li\u003e\u003c/ul\u003e |\n| **02: The Job Of Your Dreams** | \u003cul\u003e\u003cli\u003eRecreate a Account.cpp file from a Account.hpp file to produce the correct output\u003c/li\u003e\u003cli\u003ePrint deposits, withdrawals and status of an account\u003c/li\u003e\u003cli\u003etotal statistics are tracked as well\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`static` variables\u003c/li\u003e\u003cli\u003etime formatting with `std::strftime`\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 01\n\n\u003e Memory allocation, pointers to members, references, switch statement\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: BraiiiiiiinnnzzzZ** | \u003cul\u003e\u003cli\u003eZombie with name can **announce** himself\u003c/li\u003e\u003cli\u003e**newZombie** returns a heap allocated Zombie\u003c/li\u003e\u003cli\u003e**randomChump** makes a new Zombie that announces himself\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003einitializer list on an argument constructor\u003c/li\u003e\u003cli\u003eclass pointers\u003c/li\u003e\u003cli\u003e`new` keyword to allocate\u003c/li\u003e\u003cli\u003e`delete` to free the memory\u003c/li\u003e\u003c/ul\u003e |\n| **01: Moar brainz!** | \u003cul\u003e\u003cli\u003e**zombieHorde** returns a heap allocated array of Zombies\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eallocating arrays using `new`\u003c/li\u003e\u003cli\u003eusing getters and setters for private variables rather than making them public\u003c/li\u003e\u003c/ul\u003e |\n| **02: HI THIS IS BRAIN** | \u003cul\u003e\u003cli\u003ePrint addresses and values of string, string reference and string pointer\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhat's a reference and how it compares to a pointer\u003c/li\u003e\u003c/ul\u003e |\n| **03: Unnecessary violence** | \u003cul\u003e\u003cli\u003eHumanA and HumanB classes both have a Weapon\u003c/li\u003e\u003cli\u003eHumanB may not always have a Weapon, whereas HumanA will always be armed\u003c/li\u003e\u003cli\u003eSolution: HumanA has a reference to Weapon and HumanB has a pointer to Weapon (which can be NULL)\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eWhen to use pointers vs references\u003c/li\u003e\u003c/ul\u003e |\n| **04: Sed is for losers** | \u003cul\u003e\u003cli\u003eCreates a copy of the file in the argument with each occurence of a given string replaced by another\u003c/li\u003e\u003cli\u003e`std::string::replace` is forbidden\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eworking with files using `std::ifstream` and `std::ofstream`\u003c/li\u003e\u003cli\u003e`std::string` methods i.e. `erase`, `substr`\u003c/li\u003e\u003c/ul\u003e \n| **05: Harl 2.0** | \u003cul\u003e\u003cli\u003eHarl (aka Karen) can **complain** on the four levels \"DEBUG\", \"INFO\", \"WARNING\" and \"ERROR\", that just print out a message\u003c/li\u003e\u003cli\u003eYou must use **pointers to member functions** and it is forbidden to make a large `if/else` tree\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ehow to work with **pointers to member functions**\u003c/li\u003e\u003c/ul\u003e |\n| **06: Harl filter** | \u003cul\u003e\u003cli\u003ePrints all messages from the given level and above\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`switch` statement and \"fall-through\"\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 02\n\n\u003e Ad-hoc polymorphism, operator overloading and Orthodox Canonical class form\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: My First Class in Orthodox Canonical Form** | \u003cul\u003e\u003cli\u003esimple Fixed class with integer for raw bist\u003c/li\u003e\u003cli\u003estatic variable defines number of fractional bits to always 8\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**Orthodox Canonical Form**\u003c/li\u003e\u003cli\u003ecopy constructor\u003c/li\u003e\u003cli\u003ecopy assignment overload\u003c/li\u003e\u003c/ul\u003e |\n| **01: Towards a more useful fixed-point number class** | \u003cul\u003e\u003cli\u003e`int` and `float` construcors\u003c/li\u003e\u003cli\u003etoFloat and toInt conversion methods\u003c/li\u003e\u003cli\u003eoperator `\u003c\u003c` overload for printing Fixed as a `float`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003econversion between Fixed and other types using **bit-shifting**, math and `roundf`\u003c/li\u003e\u003c/ul\u003e |\n| **02: Now we’re talking** | \u003cul\u003e\u003cli\u003eoveroads for comparison operators: `\u003e`, `\u003c`, `\u003e=`, `\u003c=`, `==` and `!=`\u003c/li\u003e\u003cli\u003eoveroads for arithmetic operators: `+`, `-`, `*` and `/`\u003c/li\u003e\u003cli\u003eoveroads for increment/decrement operators (both pre and post)\u003c/li\u003e\u003cli\u003estatic min and max methods with both const and non-const arguments\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003egood practice to make comparison operators depend on each other\u003c/li\u003e\u003cli\u003ehow pre and post increment/decrement operators work on system level\u003c/li\u003e\u003cli\u003e**ternary operator**\u003c/li\u003e\u003cli\u003eprinting boolean as a word using `std::boolalpha`\u003c/li\u003e\u003c/ul\u003e |\n| **03: BSP** | \u003cul\u003e\u003cli\u003eBSP stands for Binary space partitioning, though I didn't use that as it isn't really efficient for this use case\u003c/li\u003e\u003cli\u003ePoint has const Fixed x and y variables\u003c/li\u003e\u003cli\u003ereconstruction in the copy assignment operator\u003c/li\u003e\u003cli\u003echecks if point is in triangle using vector formular\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhat's reconstruction and why to avoid it\u003c/li\u003e\u003cli\u003ealways check if an algorithm is as efficient as possible for your specific use case\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 03\n\n\u003e Inheritance\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Aaaaand... OPEN!** | \u003cul\u003e\u003cli\u003eClapTrap class with name, health, energy and damage private attributes\u003c/li\u003e\u003cli\u003eattack, takeDamage and beRepaired methods alter the attributes and print a pretty message\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003esimple exercise but I tried allocating an object for the first time\u003c/li\u003e\u003c/ul\u003e |\n| **01: Serena, my love!** | \u003cul\u003e\u003cli\u003eScavTrap inherits ClapTrap but has different values\u003c/li\u003e\u003cli\u003eoverloads attack method for specific print message\u003c/li\u003e\u003cli\u003eadds guardGate method for printing a message\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003einheritance syntax\u003c/li\u003e\u003cli\u003e`virtual` keyword for making a base class method overloadable\u003c/li\u003e\u003cli\u003ewhy having a virtual destructor is important\u003c/li\u003e\u003c/ul\u003e |\n| **02: Repetitive work** | \u003cul\u003e\u003cli\u003eFragTrap inherits ClapTrap with different values again\u003c/li\u003e\u003cli\u003eadds highFivesGuys method for printing a message\u003c/li\u003e\u003c/ul\u003e |  |\n| **03: Now it’s weird!** | \u003cul\u003e\u003cli\u003eDiamondTrap inherits both ScavTrap and FragTrap\u003c/li\u003e\u003cli\u003eadds name attribute and adds suffix to ClapTrap's name\u003c/li\u003e\u003cli\u003euses health and damage from FagTrap and energy, as well as attack method from ScavTrap\u003c/li\u003e\u003cli\u003eadds whoAmI method that prints name and ClapTrap's name\u003c/li\u003e\u003cli\u003eClapTrap subobject must only be created once\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**Diamond Problem** when doing multiple inheritance\u003c/li\u003e\u003cli\u003e`using` keyword to choose from which subclass to take method\u003c/li\u003e\u003cli\u003e**virtual inheritance** to only create one subobject\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 04\n\n\u003e Subtype polymorphism, abstract classes, interfaces\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Polymorphism** | \u003cul\u003e\u003cli\u003esimple Animal class gets inherited by Dog and Cat classes\u003c/li\u003e\u003cli\u003eAnimal has makeSound method that prints nothing, but Dog and Cat overrides the function to print an applicaple message\u003c/li\u003e\u003cli\u003eWrongAnimal and WrongCat proove understanding of method overriding\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eimplicitly casting pointer of derived class to pointer of base class\u003c/li\u003e\u003cli\u003edeepened the knowledge of the `virtual` keyword\u003c/li\u003e\u003c/ul\u003e |\n| **01: I don’t want to set the world on fire** | \u003cul\u003e\u003cli\u003eBrain class has an array of `std::string` ideas \u003c/li\u003e\u003cli\u003eDog and Cat get pointer to Brain attribute that gets allocated on construction and freed on destruction\u003cli\u003e\u003c/li\u003ecopy of ideas must be deep copies\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhy constructors and destructors are awesome for managing allocated memory\u003c/li\u003e\u003c/ul\u003e |\n| **02: Abstract class** | \u003cul\u003e\u003cli\u003eAnimal's makeSound method is made **pure virtual**\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**pure virtual** functions make classes abstract and non-instantiable, derived classed need to provide implementation if instatiation is desired\u003c/li\u003e\u003c/ul\u003e |\n| **03: Interface \u0026 recap** | \u003cul\u003e\u003cli\u003eIce, Cure, Character and MateriaSource inherit provided abstract class AMateria and interfaces ICharacter and IMateriaSource respectively\u003c/li\u003e\u003cli\u003ethey all have attributes and methods that take the objects (pointers) as arguments\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003epure abstract classes are called 'interfaces' even though they don't exist as a data structure in C++ as in other programming languages\u003c/li\u003e\u003cli\u003emore working with object pointers and references, as well as arrays and memory allocation with classes\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 05\n\n\u003e Repetition and Exceptions\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Mommy, when I grow up, I want to be a bureaucrat!** | \u003cul\u003e\u003cli\u003eBureaucrat class with grade attribute and increment/decrement methods\u003c/li\u003e\u003cli\u003eif a Bureaucreat is constructed or the grade is increment/decrement beyond the range, a Bureaucrat::GradeTooHighException or Bureaucrat::GradeTooLowException are thrown\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**exceptions** for handling errors\u003c/li\u003e\u003cli\u003ewriting my own exception class that overrides the what function, which provides the reason for the exception\u003c/li\u003e\u003cli\u003e`throw` keyword, can also throw simple data types, though `std::exception` is preferred\u003c/li\u003e\u003cli\u003e`try catch` block\u003c/li\u003e\u003c/ul\u003e |\n| **01: Form up, maggots!** | \u003cul\u003e\u003cli\u003eForm class has name, isSigned, signGrade and executeGrade attributes\u003c/li\u003e\u003cli\u003ehas beSigned method that signs the form if the grade of the Bureaucrat is valid according to the Form attributes, otherwise throws exceptions\u003c/li\u003e\u003cli\u003esignForm method is added to the Bureaucreat that calls beSigned on the provided From\u003c/li\u003e\u003c/ul\u003e |  |\n| **02: No, you need form 28B, not 28C...** | \u003cul\u003e\u003cli\u003eForm gets pure virtual execute method that makes the class abstract\u003c/li\u003e\u003cli\u003eShrubberyCreationForm, RobotomyRequestForm and PresidentialPardonForm are derived from AForm with different values and implementation for the execute method\u003c/li\u003e\u003cli\u003eadds executeForm to the Bureaucrat\u003c/li\u003e\u003c/ul\u003e |  |\n| **03: At least this beats coffee-making** | \u003cul\u003e\u003cli\u003eIntern class has a makeForm method that takes a name of a form and returns a pointer to the correct heap allocated object\u003c/li\u003e\u003c/ul\u003e |  |\n\n## CPP 06\n\n\u003e C++ casts\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Conversion of scalar types** | \u003cul\u003e\u003cli\u003eScalarConverter class contains static method convert which converts a string representation of `char`, `int`, `float` and `double` as literal to all four data types and prints them out\u003c/li\u003e\u003cli\u003epseudo literals `inf` (positive or negative) and `nan`, both float (`inff`) or double, have to be handled as well\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`static_cast` to change the datatype and keep the value\u003c/li\u003e\u003c/ul\u003e |\n| **01: Serialization** | \u003cul\u003e\u003cli\u003eSerializer class has two static methods: serialize converts Data pointer to uintptr_t, deserialize converts uintptr_t to Data pointer\u003c/li\u003e\u003cli\u003eData is just an example class to proove that it works\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`reinterpret_cast` changes the data type but keeping the exact same value\u003c/li\u003e\u003c/ul\u003e |\n| **02: Identify real type** | \u003cul\u003e\u003cli\u003eA, B, C classes are derived from Base class\u003c/li\u003e\u003cli\u003egenerate function returns a random class as a Base pointer\u003c/li\u003e\u003cli\u003eidentify prints the name of the derived class - has two implementations, one taking a Base pointer, the other taking a Base reference\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`dynamic_cast` to cast at runtime\u003c/li\u003e\u003cli\u003ereturns NULL when casting pointer, throws exception when casting object (reference)\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 07\n\n\u003e C++ templates\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Start with a few functions** | \u003cul\u003e\u003cli\u003eswap template function swaps the two given arguments\u003c/li\u003e\u003cli\u003emin and max template functions return the right value\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**template** syntax\u003c/li\u003e\u003c/ul\u003e |\n| **01: Iter** | \u003cul\u003e\u003cli\u003eiter template function iterates over an array of any type and applies the provided function to each element\u003c/li\u003e\u003c/ul\u003e |  |\n| **02: Array** | \u003cul\u003e\u003cli\u003eArray template class has pointer that allocates an array of the provided type with the size provided at construction\u003c/li\u003e\u003cli\u003eoperator `[]` overload lets you access elements inside the array\u003c/li\u003e\u003cli\u003ethrows exception if index is out of bounds\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003etemplate classes\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 08\n\n\u003e Templated containers, iterators, algorithms\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Easy find** | \u003cul\u003e\u003cli\u003etemplate function easyfind takes any container on integers and returns an iterator to the provided integer\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhat are **containers** and **iterators**\u003c/li\u003e\u003cli\u003e`std::find` algorithm to do the job\u003c/li\u003e\u003c/ul\u003e |\n| **01: Span** | \u003cul\u003e\u003cli\u003eSpan class has a `std::vector` of integers with the maximum size specified on construction\u003c/li\u003e\u003cli\u003eaddNumber and addRange (using iterators) let you add numbers to the vector\u003c/li\u003e\u003cli\u003eshortestSpan and longestSpan calculate the distance between any numbers in the vector\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`std::sort` for faster calculation of the shortest span\u003c/li\u003e\u003cli\u003e`std::min_element` and `std::max_element` for very easy calculation of longest span\u003c/li\u003e\u003c/ul\u003e |\n| **02: Mutated abomination** | \u003cul\u003e\u003cli\u003etemplate class MutantStack inherits from `std::stack` (defaults to `std::deque` container) and adds iterator and const_iterator\u003c/li\u003e\u003cli\u003ebegin and end methods return the corresponding iterator\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003emultiple typenames for a template class\u003c/li\u003e\u003cli\u003ehow iterators work in more detail\u003c/li\u003e\u003c/ul\u003e |\n\n## CPP 09\n\n\u003e STL\n\n| Exercise | Desription | Learnings |\n|----------|------------|-----------|\n| **00: Bitcoin Exchange** | \u003cul\u003e\u003cli\u003ebtc program takes file as argument which is a list of dates and values\u003c/li\u003e\u003cli\u003eprints the value multiplied the exchange rate according to the date indicated in a database 'csv' file\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e`std::map` for key-value pairs\u003c/li\u003e\u003cli\u003e`std:lower_bound` returns the first element smaller than value\u003c/li\u003e\u003cli\u003e`std::string::compare`\u003c/li\u003e\u003cli\u003e`std::runtime_error` for clean exception throwing\u003c/li\u003e\u003cli\u003eoverall working on a larger project with many C++ features\u003c/li\u003e\u003c/ul\u003e |\n| **01: Reverse Polish Notation** | \u003cul\u003e\u003cli\u003eRPN program takes string of digits and operations `+`, `-`, `*` and `/` and calculates the result in **Reverse Polish Notation**\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003ewhat **Reverse Polish Notation** is\u003c/li\u003e\u003cli\u003e`std::stack` is ideal for pushing numbers ontop then popping and calculating the top two when there is an operation and pushing pushing the result back\u003c/li\u003e\u003c/ul\u003e |\n| **02: PmergeMe** | \u003cul\u003e\u003cli\u003ePmergeMe program takes a positive integer sequence and uses **merge-insertion-sort** aka **Ford Johnson** algorithm on two containers to print a sorted sequence as well as the time it took\u003c/li\u003e\u003cli\u003ealgorithm: splits sequence into pairs, sorts each pair, recursively **merge-sort**s the pairs according to the first value, creates a sequence of all firsts of the pairs, uses **Jacobsthal** sequence to efficiently insert the sequence of seconds of the pairs into the result sequence using **insertion-sort**\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e**Ford Johnson** algorithm is one of the best when it comes to low number of comparisons\u003c/li\u003e\u003cli\u003ewhat's the **Jacobsthal** sequence and why does it make the algorithm efficient\u003c/li\u003e\u003cli\u003e`std::vector` and `std::deque` with their methods\u003c/li\u003e\u003cli\u003e`std::upper_bound` which is implemented as **binary-search** (required for insersion-sort)\u003c/li\u003e\u003c/ul\u003e |\n\n\u003cp align=\"center\"\u003eMade it! 🥵\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaron-22766%2F42_cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaron-22766%2F42_cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaron-22766%2F42_cpp/lists"}