https://github.com/madebypixel02/cpp-module-01
[42 Madrid] BraiiiiiiinnnzzzZ
https://github.com/madebypixel02/cpp-module-01
42 42-cpp-module 42-cursus 42born2code 42madrid 42school born2code brain cpp makefile peer2peer zombie
Last synced: 4 months ago
JSON representation
[42 Madrid] BraiiiiiiinnnzzzZ
- Host: GitHub
- URL: https://github.com/madebypixel02/cpp-module-01
- Owner: madebypixel02
- Created: 2022-01-12T17:01:22.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-04T15:40:45.000Z (about 3 years ago)
- Last Synced: 2025-04-05T05:24:53.124Z (10 months ago)
- Topics: 42, 42-cpp-module, 42-cursus, 42born2code, 42madrid, 42school, born2code, brain, cpp, makefile, peer2peer, zombie
- Language: C++
- Homepage:
- Size: 1.32 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CPP-Module-01 | 42 Madrid
*BraiiiiiiinnnzzzZ 🧠*
### Table of Contents
- [Introduction](#introduction)
- [ex00. BraiiiiiiinnnzzzZ](#ex00-braiiiiiiinnnzzzz)
* [Example](#example)
- [ex01. Moar brainz!](#ex01-moar-brainz)
* [Example](#example-1)
- [ex02. HI THIS IS BRAIN](#ex02-hi-this-is-brain)
* [Example](#example-2)
- [ex03. Unnecessary violence](#ex03-unnecessary-violence)
* [Example](#example-3)
- [ex04. Sed is for losers](#ex04-sed-is-for-losers)
* [Example](#example-4)
- [ex05. Karen 2.0](#ex05-karen-20)
* [Example](#example-5)
- [ex06. Karen-filter](#ex06-karen-filter)
* [Example](#example-6)
- [Installation](#installation)
- [Summary](#summary)
## Introduction
This second set of exercises is a bit more interesting. We'll be learning the basics of memory allocation in C++, references, pointers, and a rough look at switches.
## ex00. BraiiiiiiinnnzzzZ
This first exercise asks us to simply create a bunch of classes with basic methods we will use in future exercises in the module. We must have two ways of allocating instances of the class: either on the stack or on the heap, and free the allocated space at the right time.
### Example
This is an example output given my main.
## ex01. Moar brainz!
This second exercise consists of creating a method that will summon **N** zombies in one go, without naming each one of them. Then they all announce themselves and are properly destroyed.
### Example
## ex02. HI THIS IS BRAIN
This next exercise is super simple, it only aims to differentiate between pointers and references
### Example
## ex03. Unnecessary violence
This one extends the concepts of references and pointers from the previous exercise, creating two types of humans in two classes that can attack each other with different weapons.
### Example
## ex04. Sed is for losers
This exercise aims to replicate the basic performance of the **sed** command (**s**tream **ed**itor), receiving a file and a string to replace with another. It saves the output to a file with the same name ending in *.replace*. This exercise helps us understand file streams and strings in C++.
### Example
Note: the example above shows how the replace operation is reversible (unsurprisingly).
## ex05. Karen 2.0
The next two exercises expand on the idea of refernces a bit further. We create a **Karen** class that can give various messages of types **DEBUG**, **INFO**, **WARNING** and **ERROR**. We are asked to create that outputs the proper message depending message type.
### Example
## ex06. Karen-filter
This last exercise is an extension of the previous one. However this time we receive the message type from the user and output that type's message and all the message types above it (order is **DEBUG** < **INFO** < **WARNING** < **ERROR**). We must coordinate the responses using switches for this exercise.
### Example
Note how the **DEBUG** message is not shown because it is below **INFO**.
## Installation
For this project and fututre C++ projects it is only required to have `clang` and/or `gcc`, which provide their respective compilers `clang++` and `g++`. It is also recommended to install the `valgrind` package on **Linux** for debugging purposes. Every exercise (unless specified otherwise) includes its own Makefile with the necessary instructions. In some cases certain tweaks needed to be made to ensure the most similar results in both **Linux** and **MacOS**.
## Summary
This one was definitely harder than the previous one, but it was still pretty fun.
June 13th, 2022