Bläddra i källkod

first commit of backup

bastien 1 månad sedan
incheckning
f0112dee04
100 ändrade filer med 2295 tillägg och 0 borttagningar
  1. 65 0
      Makefile
  2. BIN
      Module_00/ex00/.objects/main.o
  3. 50 0
      Module_00/ex00/Makefile
  4. BIN
      Module_00/ex00/ex00
  5. 31 0
      Module_00/ex00/srcs/main.cpp
  6. 50 0
      Module_00/ex01/Makefile
  7. 27 0
      Module_00/ex01/includes/Contact.class.hpp
  8. 18 0
      Module_00/ex01/includes/Phonebook.class.hpp
  9. 32 0
      Module_00/ex01/srcs/Contact.class.cpp
  10. 9 0
      Module_00/ex01/srcs/Phonebook.class.cpp
  11. 70 0
      Module_00/ex01/srcs/main.cpp
  12. BIN
      Module_00/ex02/.objects/Account.class.o
  13. BIN
      Module_00/ex02/.objects/main.o
  14. 59 0
      Module_00/ex02/19920104_091532.log
  15. 69 0
      Module_00/ex02/Account.hpp
  16. 50 0
      Module_00/ex02/Makefile
  17. BIN
      Module_00/ex02/ex00
  18. 69 0
      Module_00/ex02/includes/Account.class.hpp
  19. 119 0
      Module_00/ex02/srcs/Account.class.cpp
  20. 72 0
      Module_00/ex02/srcs/main.cpp
  21. 72 0
      Module_00/ex02/tests.cpp
  22. BIN
      Module_00/fr.subject.pdf
  23. BIN
      Module_01/en.subject.pdf
  24. BIN
      Module_01/ex00/.objects/Zombie.o
  25. BIN
      Module_01/ex00/.objects/main.o
  26. BIN
      Module_01/ex00/.objects/newZombie.o
  27. BIN
      Module_01/ex00/.objects/randomChump.o
  28. BIN
      Module_01/ex00/.objects/zombieHorde.o
  29. 50 0
      Module_01/ex00/Makefile
  30. BIN
      Module_01/ex00/ex00
  31. 30 0
      Module_01/ex00/includes/Zombie.hpp
  32. 36 0
      Module_01/ex00/srcs/Zombie.cpp
  33. 27 0
      Module_01/ex00/srcs/main.cpp
  34. 17 0
      Module_01/ex00/srcs/newZombie.cpp
  35. 20 0
      Module_01/ex00/srcs/randomChump.cpp
  36. 25 0
      Module_01/ex00/srcs/zombieHorde.cpp
  37. BIN
      Module_01/ex01/.objects/Zombie.o
  38. BIN
      Module_01/ex01/.objects/main.o
  39. BIN
      Module_01/ex01/.objects/newZombie.o
  40. BIN
      Module_01/ex01/.objects/randomChump.o
  41. BIN
      Module_01/ex01/.objects/zombieHorde.o
  42. 50 0
      Module_01/ex01/Makefile
  43. BIN
      Module_01/ex01/ex00
  44. 30 0
      Module_01/ex01/includes/Zombie.hpp
  45. 36 0
      Module_01/ex01/srcs/Zombie.cpp
  46. 27 0
      Module_01/ex01/srcs/main.cpp
  47. 17 0
      Module_01/ex01/srcs/newZombie.cpp
  48. 20 0
      Module_01/ex01/srcs/randomChump.cpp
  49. 25 0
      Module_01/ex01/srcs/zombieHorde.cpp
  50. BIN
      Module_01/ex02/.objects/main.o
  51. 50 0
      Module_01/ex02/Makefile
  52. BIN
      Module_01/ex02/ex00
  53. 30 0
      Module_01/ex02/srcs/main.cpp
  54. BIN
      Module_01/ex03/.objects/HumanA.class.o
  55. BIN
      Module_01/ex03/.objects/HumanB.class.o
  56. BIN
      Module_01/ex03/.objects/Weapon.class.o
  57. BIN
      Module_01/ex03/.objects/main.o
  58. 50 0
      Module_01/ex03/Makefile
  59. BIN
      Module_01/ex03/ex00
  60. 31 0
      Module_01/ex03/includes/HumanA.class.hpp
  61. 32 0
      Module_01/ex03/includes/HumanB.class.hpp
  62. 30 0
      Module_01/ex03/includes/Weapon.class.hpp
  63. 27 0
      Module_01/ex03/srcs/HumanA.class.cpp
  64. 32 0
      Module_01/ex03/srcs/HumanB.class.cpp
  65. 30 0
      Module_01/ex03/srcs/Weapon.class.cpp
  66. 35 0
      Module_01/ex03/srcs/main.cpp
  67. BIN
      Module_01/ex03/weapon.tar.gz
  68. BIN
      Module_01/ex04/.objects/main.o
  69. 50 0
      Module_01/ex04/Makefile
  70. BIN
      Module_01/ex04/ex00
  71. 34 0
      Module_01/ex04/srcs/main.cpp
  72. 34 0
      Module_01/ex04/srcs/main.cpp.replace
  73. 3 0
      Module_01/ex04/test
  74. 3 0
      Module_01/ex04/test.replace
  75. BIN
      Module_01/ex05/.objects/harl.class.o
  76. BIN
      Module_01/ex05/.objects/main.o
  77. 50 0
      Module_01/ex05/Makefile
  78. BIN
      Module_01/ex05/ex00
  79. 30 0
      Module_01/ex05/includes/harl.class.hpp
  80. 45 0
      Module_01/ex05/srcs/harl.class.cpp
  81. 20 0
      Module_01/ex05/srcs/main.cpp
  82. BIN
      Module_01/ex06/.objects/harl.class.o
  83. BIN
      Module_01/ex06/.objects/main.o
  84. 50 0
      Module_01/ex06/Makefile
  85. BIN
      Module_01/ex06/ex00
  86. 32 0
      Module_01/ex06/includes/harl.class.hpp
  87. 50 0
      Module_01/ex06/srcs/harl.class.cpp
  88. 28 0
      Module_01/ex06/srcs/main.cpp
  89. BIN
      Module_02/ex00/.objects/Fixed.class.o
  90. BIN
      Module_02/ex00/.objects/main.o
  91. 50 0
      Module_02/ex00/Makefile
  92. BIN
      Module_02/ex00/ex00
  93. 32 0
      Module_02/ex00/includes/Fixed.class.hpp
  94. 47 0
      Module_02/ex00/srcs/Fixed.class.cpp
  95. 28 0
      Module_02/ex00/srcs/main.cpp
  96. BIN
      Module_02/ex01/.objects/Fixed.class.o
  97. BIN
      Module_02/ex01/.objects/main.o
  98. 50 0
      Module_02/ex01/Makefile
  99. BIN
      Module_02/ex01/ex00
  100. 40 0
      Module_02/ex01/includes/Fixed.class.hpp

+ 65 - 0
Makefile

@@ -0,0 +1,65 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2018/10/26 11:18:16 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ft_ssl
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+LIBS_DIR = libs/
+CC = gcc -Wall -Wextra -Werror -g
+LIB = -L./$(LIBS_DIR)/libft/ -lft
+INC = -I./includes -I./$(LIBS_DIR)/libft/includes
+FILES = main \
+		sl_get_inf \
+		sl_core \
+		sl_hash \
+		sl_md5 \
+		sl_sha2 \
+		sl_sha3_5 \
+		sl_sha_init \
+		sl_sha_registers
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: libs $(NAME)
+
+libs:
+	@$(MAKE_LIBS) -C $(LIBS_DIR)/libft
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(LIB) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.c
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+	@$(MAKE_LIBS) clean -C $(LIBS_DIR)/libft
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+	@$(MAKE_LIBS) fclean -C $(LIBS_DIR)/libft
+
+re: fclean all
+
+.PHONY: all libs clean fclean re

BIN
Module_00/ex00/.objects/main.o


+ 50 - 0
Module_00/ex00/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2018/10/26 11:18:16 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_00/ex00/ex00


+ 31 - 0
Module_00/ex00/srcs/main.cpp

@@ -0,0 +1,31 @@
+#include <iostream>
+
+
+void	ft_toUpper(char *s) {
+	while (*s) {
+		if (*s >= 97 && *s <= 122)
+			std::cout << char(*s - 32) ;
+		else
+			std::cout << char(*s);
+		s++;
+	}
+}
+
+int main(int ac, char **av) {
+
+	int cpt;
+
+	if (ac == 1) {
+		std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *" << std::endl;
+		return 0;
+	}
+
+	cpt = 1;
+	while (cpt < ac) {
+		ft_toUpper(av[cpt]);
+		std::cout << " ";
+		cpt++;
+	}
+	std::cout << std::endl;
+	return 0;
+}

+ 50 - 0
Module_00/ex01/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/08 16:10:17 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Phonebook.class Contact.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

+ 27 - 0
Module_00/ex01/includes/Contact.class.hpp

@@ -0,0 +1,27 @@
+#ifndef CONTACT_CLASS_H
+# define CONTACT_CLASS_H
+
+#include <iostream>
+
+class Contact {
+public:
+
+	std::string	first_name;
+	std::string	last_name;
+	std::string	nickname;
+	std::string	number;
+
+	Contact(void);
+	~Contact(void);
+
+	void getContact() const;
+	void setContact(const std::string& secret, const std::string& first_name,
+					 const std::string& last_name, const std::string& nickname,
+					 const std::string& number);
+
+private:
+
+	std::string _secret;
+};
+
+#endif

+ 18 - 0
Module_00/ex01/includes/Phonebook.class.hpp

@@ -0,0 +1,18 @@
+#ifndef PHONEBOOK_CLASS_H
+# define PHONEBOOK_CLASS_H
+
+#include "Contact.class.hpp"
+
+class Phonebook {
+public:
+
+	int			cpt;
+	int			nb;
+
+	Phonebook(void);
+	~Phonebook(void);
+
+	Contact		contact[8];
+};
+
+#endif

+ 32 - 0
Module_00/ex01/srcs/Contact.class.cpp

@@ -0,0 +1,32 @@
+#include "Contact.class.hpp"
+#include <iostream>
+
+Contact::Contact(void)  {
+	return ;
+}
+
+Contact::~Contact(void) {
+	return ;
+}
+
+
+void Contact::setContact(const std::string &secret,
+                         const std::string &first_name,
+                         const std::string &last_name,
+                         const std::string &nickname,
+                         const std::string &number) {
+	
+	this->_secret = secret.empty() ? "NA" : secret;
+	this->first_name = first_name.empty() ? "NA" : first_name;
+	this->last_name = last_name.empty() ? "NA" : last_name;
+	this->nickname = nickname.empty() ? "NA" : nickname;
+	this->number = number.empty() ? "NA" : number;
+}
+
+void Contact::getContact() const {
+	std::cout << "First name: " << first_name << std::endl;
+	std::cout << "Last name: " << last_name << std::endl;
+	std::cout << "Nickname: " << nickname << std::endl;
+	std::cout << "Number: " << number << std::endl;
+	std::cout << "Secret: " << _secret << std::endl;
+}

+ 9 - 0
Module_00/ex01/srcs/Phonebook.class.cpp

@@ -0,0 +1,9 @@
+#include "Phonebook.class.hpp"
+
+Phonebook::Phonebook(void) : cpt(0), nb(0) {
+	return ;
+}
+
+Phonebook::~Phonebook(void) {
+	return ;
+}

+ 70 - 0
Module_00/ex01/srcs/main.cpp

@@ -0,0 +1,70 @@
+#include <iostream>
+#include <string.h>
+#include "Phonebook.class.hpp"
+#include "Contact.class.hpp"
+#include <iomanip>
+
+
+void	ft_search(Phonebook *Phonebook) {
+	int			cpt;
+	std::string	index;
+
+	cpt = 0;
+	std::cout << "     Index|First Nam.| Last Name|  Nickname" << std::endl;
+	while (cpt < Phonebook->nb) {
+		std::cout << std::setw(10) << cpt << "|";
+		if (Phonebook->contact[cpt].first_name.length() > 10)
+			std::cout << std::setw(9) << Phonebook->contact[cpt].first_name.substr(0, 9) << ".|";
+		else
+			std::cout << std::setw(10) << Phonebook->contact[cpt].first_name << "|" ;
+		if (Phonebook->contact[cpt].last_name.length() > 10)
+			std::cout << std::setw(9) << Phonebook->contact[cpt].last_name.substr(0, 9) << ".|";
+		else
+			std::cout << std::setw(10) << Phonebook->contact[cpt].last_name << "|" ;
+		if (Phonebook->contact[cpt].nickname.length() > 10)
+			std::cout << std::setw(9) << Phonebook->contact[cpt].nickname.substr(0, 9) << ".|";
+		else
+			std::cout << std::setw(10) << Phonebook->contact[cpt].nickname << "|" ;
+		std::cout << std::endl;
+		cpt++;
+	}
+	std::cout << "which contact would you like to check ? (1-8) : "; std::getline(std::cin, index);
+	if (std::stoi(index) < 8)
+		Phonebook->contact[std::stoi(index)].getContact();
+}
+
+void	ft_add(Phonebook *Phonebook) {
+	std::string	first_name;
+	std::string	last_name;
+	std::string	nickname;
+	std::string	number;
+	std::string secret;
+
+	std::cout << "Enter First name : "; std::getline(std::cin, first_name);
+	std::cout << "Enter Last name : "; std::getline(std::cin, last_name);
+	std::cout << "Enter Nickname : "; std::getline(std::cin, nickname);
+	std::cout << "Enter Number : "; std::getline(std::cin, number);
+	std::cout << "Enter Secret : "; std::getline(std::cin, secret);
+
+	Phonebook->contact[Phonebook->cpt % 8].setContact(secret, first_name, last_name, nickname, number);
+	Phonebook->cpt++;
+	Phonebook->nb = Phonebook->nb == 8 ? 8 : Phonebook->nb + 1;
+}
+
+int main(void) {
+
+	std::string	cmd;;
+	Phonebook	phonebook;
+
+	while (true) {
+		std::cout << "enter a command : ";
+		std::getline(std::cin, cmd);
+		if (cmd == "ADD")
+			ft_add(&phonebook);
+		else if (cmd == "SEARCH")
+			ft_search(&phonebook);
+		else if (cmd == "EXIT")
+			break ;
+	}
+	return 0;
+}

BIN
Module_00/ex02/.objects/Account.class.o


BIN
Module_00/ex02/.objects/main.o


+ 59 - 0
Module_00/ex02/19920104_091532.log

@@ -0,0 +1,59 @@
+[19920104_091532] index:0;amount:42;created
+[19920104_091532] index:1;amount:54;created
+[19920104_091532] index:2;amount:957;created
+[19920104_091532] index:3;amount:432;created
+[19920104_091532] index:4;amount:1234;created
+[19920104_091532] index:5;amount:0;created
+[19920104_091532] index:6;amount:754;created
+[19920104_091532] index:7;amount:16576;created
+[19920104_091532] accounts:8;total:20049;deposits:0;withdrawals:0
+[19920104_091532] index:0;amount:42;deposits:0;withdrawals:0
+[19920104_091532] index:1;amount:54;deposits:0;withdrawals:0
+[19920104_091532] index:2;amount:957;deposits:0;withdrawals:0
+[19920104_091532] index:3;amount:432;deposits:0;withdrawals:0
+[19920104_091532] index:4;amount:1234;deposits:0;withdrawals:0
+[19920104_091532] index:5;amount:0;deposits:0;withdrawals:0
+[19920104_091532] index:6;amount:754;deposits:0;withdrawals:0
+[19920104_091532] index:7;amount:16576;deposits:0;withdrawals:0
+[19920104_091532] index:0;p_amount:42;deposit:5;amount:47;nb_deposits:1
+[19920104_091532] index:1;p_amount:54;deposit:765;amount:819;nb_deposits:1
+[19920104_091532] index:2;p_amount:957;deposit:564;amount:1521;nb_deposits:1
+[19920104_091532] index:3;p_amount:432;deposit:2;amount:434;nb_deposits:1
+[19920104_091532] index:4;p_amount:1234;deposit:87;amount:1321;nb_deposits:1
+[19920104_091532] index:5;p_amount:0;deposit:23;amount:23;nb_deposits:1
+[19920104_091532] index:6;p_amount:754;deposit:9;amount:763;nb_deposits:1
+[19920104_091532] index:7;p_amount:16576;deposit:20;amount:16596;nb_deposits:1
+[19920104_091532] accounts:8;total:21524;deposits:8;withdrawals:0
+[19920104_091532] index:0;amount:47;deposits:1;withdrawals:0
+[19920104_091532] index:1;amount:819;deposits:1;withdrawals:0
+[19920104_091532] index:2;amount:1521;deposits:1;withdrawals:0
+[19920104_091532] index:3;amount:434;deposits:1;withdrawals:0
+[19920104_091532] index:4;amount:1321;deposits:1;withdrawals:0
+[19920104_091532] index:5;amount:23;deposits:1;withdrawals:0
+[19920104_091532] index:6;amount:763;deposits:1;withdrawals:0
+[19920104_091532] index:7;amount:16596;deposits:1;withdrawals:0
+[19920104_091532] index:0;p_amount:47;withdrawal:refused
+[19920104_091532] index:1;p_amount:819;withdrawal:34;amount:785;nb_withdrawals:1
+[19920104_091532] index:2;p_amount:1521;withdrawal:657;amount:864;nb_withdrawals:1
+[19920104_091532] index:3;p_amount:434;withdrawal:4;amount:430;nb_withdrawals:1
+[19920104_091532] index:4;p_amount:1321;withdrawal:76;amount:1245;nb_withdrawals:1
+[19920104_091532] index:5;p_amount:23;withdrawal:refused
+[19920104_091532] index:6;p_amount:763;withdrawal:657;amount:106;nb_withdrawals:1
+[19920104_091532] index:7;p_amount:16596;withdrawal:7654;amount:8942;nb_withdrawals:1
+[19920104_091532] accounts:8;total:12442;deposits:8;withdrawals:6
+[19920104_091532] index:0;amount:47;deposits:1;withdrawals:0
+[19920104_091532] index:1;amount:785;deposits:1;withdrawals:1
+[19920104_091532] index:2;amount:864;deposits:1;withdrawals:1
+[19920104_091532] index:3;amount:430;deposits:1;withdrawals:1
+[19920104_091532] index:4;amount:1245;deposits:1;withdrawals:1
+[19920104_091532] index:5;amount:23;deposits:1;withdrawals:0
+[19920104_091532] index:6;amount:106;deposits:1;withdrawals:1
+[19920104_091532] index:7;amount:8942;deposits:1;withdrawals:1
+[19920104_091532] index:0;amount:47;closed
+[19920104_091532] index:1;amount:785;closed
+[19920104_091532] index:2;amount:864;closed
+[19920104_091532] index:3;amount:430;closed
+[19920104_091532] index:4;amount:1245;closed
+[19920104_091532] index:5;amount:23;closed
+[19920104_091532] index:6;amount:106;closed
+[19920104_091532] index:7;amount:8942;closed

+ 69 - 0
Module_00/ex02/Account.hpp

@@ -0,0 +1,69 @@
+// ************************************************************************** //
+//                                                                            //
+//                Account.hpp for GlobalBanksters United                //
+//                Created on  : Thu Nov 20 19:43:15 1989                      //
+//                Last update : Wed Jan 04 14:54:06 1992                      //
+//                Made by : Brad "Buddy" McLane <bm@gbu.com>                  //
+//                                                                            //
+// ************************************************************************** //
+
+
+#pragma once
+#ifndef __ACCOUNT_H__
+#define __ACCOUNT_H__
+
+// ************************************************************************** //
+//                               Account Class                                //
+// ************************************************************************** //
+
+class Account {
+
+
+public:
+
+	typedef Account		t;
+
+	static int	getNbAccounts( void );
+	static int	getTotalAmount( void );
+	static int	getNbDeposits( void );
+	static int	getNbWithdrawals( void );
+	static void	displayAccountsInfos( void );
+
+	Account( int initial_deposit );
+	~Account( void );
+
+	void	makeDeposit( int deposit );
+	bool	makeWithdrawal( int withdrawal );
+	int		checkAmount( void ) const;
+	void	displayStatus( void ) const;
+
+
+private:
+
+	static int	_nbAccounts;
+	static int	_totalAmount;
+	static int	_totalNbDeposits;
+	static int	_totalNbWithdrawals;
+
+	static void	_displayTimestamp( void );
+
+	int				_accountIndex;
+	int				_amount;
+	int				_nbDeposits;
+	int				_nbWithdrawals;
+
+	Account( void );
+
+};
+
+
+
+// ************************************************************************** //
+// vim: set ts=4 sw=4 tw=80 noexpandtab:                                      //
+// -*- indent-tabs-mode:t;                                                   -*-
+// -*- mode: c++-mode;                                                       -*-
+// -*- fill-column: 75; comment-column: 75;                                  -*-
+// ************************************************************************** //
+
+
+#endif /* __ACCOUNT_H__ */

+ 50 - 0
Module_00/ex02/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/09 19:53:59 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Account.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_00/ex02/ex00


+ 69 - 0
Module_00/ex02/includes/Account.class.hpp

@@ -0,0 +1,69 @@
+// ************************************************************************** //
+//                                                                            //
+//                Account.hpp for GlobalBanksters United                //
+//                Created on  : Thu Nov 20 19:43:15 1989                      //
+//                Last update : Wed Jan 04 14:54:06 1992                      //
+//                Made by : Brad "Buddy" McLane <bm@gbu.com>                  //
+//                                                                            //
+// ************************************************************************** //
+
+
+#pragma once
+#ifndef __ACCOUNT_H__
+#define __ACCOUNT_H__
+
+// ************************************************************************** //
+//                               Account Class                                //
+// ************************************************************************** //
+
+class Account {
+
+
+public:
+
+	typedef Account		t;
+
+	static int	getNbAccounts( void );
+	static int	getTotalAmount( void );
+	static int	getNbDeposits( void );
+	static int	getNbWithdrawals( void );
+	static void	displayAccountsInfos( void );
+
+	Account( int initial_deposit );
+	~Account( void );
+
+	void	makeDeposit( int deposit );
+	bool	makeWithdrawal( int withdrawal );
+	int		checkAmount( void ) const;
+	void	displayStatus( void ) const;
+
+
+private:
+
+	static int	_nbAccounts;
+	static int	_totalAmount;
+	static int	_totalNbDeposits;
+	static int	_totalNbWithdrawals;
+
+	static void	_displayTimestamp( void );
+
+	int				_accountIndex;
+	int				_amount;
+	int				_nbDeposits;
+	int				_nbWithdrawals;
+
+	Account( void );
+
+};
+
+
+
+// ************************************************************************** //
+// vim: set ts=4 sw=4 tw=80 noexpandtab:                                      //
+// -*- indent-tabs-mode:t;                                                   -*-
+// -*- mode: c++-mode;                                                       -*-
+// -*- fill-column: 75; comment-column: 75;                                  -*-
+// ************************************************************************** //
+
+
+#endif /* __ACCOUNT_H__ */

+ 119 - 0
Module_00/ex02/srcs/Account.class.cpp

@@ -0,0 +1,119 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Account.class.cpp                                  :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/09 15:55:31 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/09 20:42:20 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Account.class.hpp"
+#include <iostream>
+#include <iomanip>
+#include <ctime>
+
+Account::Account(int initial_deposit) : _amount(initial_deposit) {
+	Account::_totalAmount += initial_deposit;
+	Account::_displayTimestamp();
+	this->_accountIndex = Account::_nbAccounts;
+	Account::_nbAccounts += 1;
+	std::cout << "index:" << this->_accountIndex << ";";
+	std::cout << "amount:" << this->_amount << ";";
+	std::cout << "created" << std::endl;
+	return ;
+}
+
+Account::~Account(void) {
+	Account::_displayTimestamp();
+	std::cout << "index:" << this->_accountIndex << ";";
+	std::cout << "amount:" << this->_amount << ";";
+	std::cout << "closed" << std::endl;
+	return ;
+}
+
+int	Account::getNbAccounts( void ) {
+	return Account::_nbAccounts;
+}
+
+
+int	Account::getTotalAmount( void ) {
+	return Account::_totalAmount;
+}
+
+int	Account::getNbDeposits( void ) {
+	return Account::_totalNbDeposits;
+}
+
+int	Account::getNbWithdrawals( void ) {
+	return Account::_totalNbWithdrawals;
+}
+
+void	Account::displayAccountsInfos( void ) {
+	Account::_displayTimestamp();
+	std::cout << "accounts:" << Account::_nbAccounts << ";";
+	std::cout << "total:" << Account::_totalAmount << ";";
+	std::cout << "deposits:" << Account::_totalNbDeposits << ";";
+	std::cout << "withdrawals:" << Account::_totalNbWithdrawals << ";";
+	std::cout << std::endl;
+}
+
+void	Account::makeDeposit( int deposit ) {
+	Account::_displayTimestamp();
+	std::cout << "index:" << this->_accountIndex << ";";
+	std::cout << "p_amount:" << this->_amount << ";";
+	this->_amount += deposit;
+	Account::_totalAmount += deposit;
+	this->_nbDeposits = Account::_totalNbDeposits += 1;
+	std::cout << "deposit:" << deposit << ";";
+	std::cout << "amount:" << this->_amount << ";";
+	std::cout << "nb_deposits:" << this->_nbDeposits << ";";
+	std::cout << std::endl;
+	return ;
+}
+
+bool	Account::makeWithdrawal( int withdrawal ) {
+	Account::_displayTimestamp();
+	std::cout << "index:" << this->_accountIndex << ";";
+	std::cout << "p_amount:" << this->_amount << ";";
+	if (this->_amount < withdrawal) {
+		std::cout << "withdrawal:refused" << std::endl;
+		return false;
+	}
+	this->_amount -= withdrawal;
+	Account::_totalAmount -= withdrawal;
+	this->_nbWithdrawals = Account::_totalNbWithdrawals += 1;
+	std::cout << "withdrawal:" << withdrawal << ";";
+	std::cout << "amount:" << this->_amount << ";";
+	std::cout << "nb_withdrawals:" << this->_nbWithdrawals << ";";
+	std::cout << std::endl;
+	return true;
+}
+
+int		Account::checkAmount( void ) const {
+	return this->_amount;
+}
+
+void	Account::displayStatus( void ) const {
+	Account::_displayTimestamp();
+	std::cout << "index:" << this->_accountIndex << ";";
+	std::cout << "amount:" << this->_amount << ";";
+	std::cout << "deposits:" << this->_nbDeposits << ";";
+	std::cout << "withdrawals:" << this->_nbWithdrawals << ";";
+	std::cout << std::endl;
+}
+
+
+void	Account::_displayTimestamp( void ) {
+	std::time_t now = std::time(nullptr);
+	std::tm* tm_now = std::localtime(&now);
+
+	std::cout << "[" << std::put_time(tm_now, "%Y%m%d_%H%M%S") << "] ";
+}
+
+int	Account::_nbAccounts = 0;
+int Account::_totalAmount = 0;
+int	Account::_totalNbDeposits = 0;
+int	Account::_totalNbWithdrawals = 0;

+ 72 - 0
Module_00/ex02/srcs/main.cpp

@@ -0,0 +1,72 @@
+// ************************************************************************** //
+//                                                                            //
+//                tests.cpp for GlobalBanksters United                        //
+//                Created on  : Thu Nov 20 23:45:02 1989                      //
+//                Last update : Wed Jan 04 09:23:52 1992                      //
+//                Made by : Brad "Buddy" McLane <bm@gbu.com>                  //
+//                                                                            //
+// ************************************************************************** //
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include "Account.class.hpp"
+
+
+int		main( void ) {
+
+	typedef std::vector<Account::t>							  accounts_t;
+	typedef std::vector<int>								  ints_t;
+	typedef std::pair<accounts_t::iterator, ints_t::iterator> acc_int_t;
+
+	int	const				amounts[]	= { 42, 54, 957, 432, 1234, 0, 754, 16576 };
+	size_t const			amounts_size( sizeof(amounts) / sizeof(int) );
+	accounts_t				accounts( amounts, amounts + amounts_size );
+	accounts_t::iterator	acc_begin	= accounts.begin();
+	accounts_t::iterator	acc_end		= accounts.end();
+
+	int	const			d[]			= { 5, 765, 564, 2, 87, 23, 9, 20 };
+	size_t const		d_size( sizeof(d) / sizeof(int) );
+	ints_t				deposits( d, d + d_size );
+	ints_t::iterator	dep_begin	= deposits.begin();
+	ints_t::iterator	dep_end		= deposits.end();
+
+	int	const			w[]			= { 321, 34, 657, 4, 76, 275, 657, 7654 };
+	size_t const		w_size( sizeof(w) / sizeof(int) );
+	ints_t				withdrawals( w, w + w_size );
+	ints_t::iterator	wit_begin	= withdrawals.begin();
+	ints_t::iterator	wit_end		= withdrawals.end();
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fn( &Account::displayStatus ) );
+
+	for ( acc_int_t it( acc_begin, dep_begin );
+		  it.first != acc_end && it.second != dep_end;
+		  ++(it.first), ++(it.second) ) {
+
+		(*(it.first)).makeDeposit( *(it.second) );
+	}
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fn( &Account::displayStatus ) );
+
+	for ( acc_int_t it( acc_begin, wit_begin );
+		  it.first != acc_end && it.second != wit_end;
+		  ++(it.first), ++(it.second) ) {
+
+		(*(it.first)).makeWithdrawal( *(it.second) );
+	}
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fn( &Account::displayStatus ) );
+
+	return 0;
+}
+
+
+// ************************************************************************** //
+// vim: set ts=4 sw=4 tw=80 noexpandtab:                                      //
+// -*- indent-tabs-mode:t;                                                   -*-
+// -*- mode: c++-mode;                                                       -*-
+// -*- fill-column: 75; comment-column: 75;                                  -*-
+// ************************************************************************** //

+ 72 - 0
Module_00/ex02/tests.cpp

@@ -0,0 +1,72 @@
+// ************************************************************************** //
+//                                                                            //
+//                tests.cpp for GlobalBanksters United                        //
+//                Created on  : Thu Nov 20 23:45:02 1989                      //
+//                Last update : Wed Jan 04 09:23:52 1992                      //
+//                Made by : Brad "Buddy" McLane <bm@gbu.com>                  //
+//                                                                            //
+// ************************************************************************** //
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include "Account.hpp"
+
+
+int		main( void ) {
+
+	typedef std::vector<Account::t>							  accounts_t;
+	typedef std::vector<int>								  ints_t;
+	typedef std::pair<accounts_t::iterator, ints_t::iterator> acc_int_t;
+
+	int	const				amounts[]	= { 42, 54, 957, 432, 1234, 0, 754, 16576 };
+	size_t const			amounts_size( sizeof(amounts) / sizeof(int) );
+	accounts_t				accounts( amounts, amounts + amounts_size );
+	accounts_t::iterator	acc_begin	= accounts.begin();
+	accounts_t::iterator	acc_end		= accounts.end();
+
+	int	const			d[]			= { 5, 765, 564, 2, 87, 23, 9, 20 };
+	size_t const		d_size( sizeof(d) / sizeof(int) );
+	ints_t				deposits( d, d + d_size );
+	ints_t::iterator	dep_begin	= deposits.begin();
+	ints_t::iterator	dep_end		= deposits.end();
+
+	int	const			w[]			= { 321, 34, 657, 4, 76, 275, 657, 7654 };
+	size_t const		w_size( sizeof(w) / sizeof(int) );
+	ints_t				withdrawals( w, w + w_size );
+	ints_t::iterator	wit_begin	= withdrawals.begin();
+	ints_t::iterator	wit_end		= withdrawals.end();
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
+
+	for ( acc_int_t it( acc_begin, dep_begin );
+		  it.first != acc_end && it.second != dep_end;
+		  ++(it.first), ++(it.second) ) {
+
+		(*(it.first)).makeDeposit( *(it.second) );
+	}
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
+
+	for ( acc_int_t it( acc_begin, wit_begin );
+		  it.first != acc_end && it.second != wit_end;
+		  ++(it.first), ++(it.second) ) {
+
+		(*(it.first)).makeWithdrawal( *(it.second) );
+	}
+
+	Account::displayAccountsInfos();
+	std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
+
+	return 0;
+}
+
+
+// ************************************************************************** //
+// vim: set ts=4 sw=4 tw=80 noexpandtab:                                      //
+// -*- indent-tabs-mode:t;                                                   -*-
+// -*- mode: c++-mode;                                                       -*-
+// -*- fill-column: 75; comment-column: 75;                                  -*-
+// ************************************************************************** //

BIN
Module_00/fr.subject.pdf


BIN
Module_01/en.subject.pdf


BIN
Module_01/ex00/.objects/Zombie.o


BIN
Module_01/ex00/.objects/main.o


BIN
Module_01/ex00/.objects/newZombie.o


BIN
Module_01/ex00/.objects/randomChump.o


BIN
Module_01/ex00/.objects/zombieHorde.o


+ 50 - 0
Module_01/ex00/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/15 14:44:55 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Zombie zombieHorde randomChump newZombie
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex00/ex00


+ 30 - 0
Module_01/ex00/includes/Zombie.hpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Zombie.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:42:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:47:35 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include <iostream>
+
+class	Zombie {
+	public:
+		Zombie(std::string name);
+		Zombie(void);
+		~Zombie(void);
+
+		void	announce(void) const;
+		void	setZombie(std::string name);
+
+	private:
+		std::string	_name;
+};
+
+Zombie	*newZombie( std::string name);
+void	randomChump( std::string name );
+Zombie	*zombieHorde( int N, std::string name );

+ 36 - 0
Module_01/ex00/srcs/Zombie.cpp

@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Zombie.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:44:24 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:48:08 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+#include <iostream>
+
+Zombie::Zombie(std::string name) : _name(name) {
+	std::cout << "Constructor of " << name << "called" << std::endl;
+	return ;
+}
+
+Zombie::Zombie(void) : _name("defaultName") {
+	std::cout << "Constructor of " << this->_name << "called" << std::endl;
+	return ;
+}
+Zombie::~Zombie(void) {
+	std::cout << "Destructor of " << this->_name << "called" << std::endl;
+	return ;
+}
+
+void	Zombie::announce(void) const {
+	std::cout << this->_name << ": BraiiiiiiiinnnnzzzzZ..." << std::endl;
+}
+
+void	Zombie::setZombie(std::string name) {
+	this->_name = name;
+}

+ 27 - 0
Module_01/ex00/srcs/main.cpp

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 14:30:32 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:50:07 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+#include <iostream>
+
+int	main(void) {
+	
+	randomChump("testouille");
+	Zombie *ZombieTest = newZombie("tameouilr");
+
+	delete(ZombieTest);
+	ZombieTest = zombieHorde(4, "tameouilr2121");
+	for (int i = 0; i < 4; i++)
+		ZombieTest[i].announce();
+	delete [] ZombieTest;
+	return 0;
+}

+ 17 - 0
Module_01/ex00/srcs/newZombie.cpp

@@ -0,0 +1,17 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   newZombie.cpp                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:51:00 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 13:56:23 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+Zombie	*newZombie(std::string name) {
+	return new	Zombie(name);
+}

+ 20 - 0
Module_01/ex00/srcs/randomChump.cpp

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   randomChump.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:56:38 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 13:58:18 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+void	randomChump(std::string name) {
+	Zombie	zombie(name);
+
+	zombie.announce();
+	return ;
+}

+ 25 - 0
Module_01/ex00/srcs/zombieHorde.cpp

@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   zombieHorde.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:58:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:30:26 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+Zombie	*zombieHorde(int N, std::string name) {
+	Zombie *zombies = new Zombie[N];
+	int i;
+
+	i = 0;
+	while (i < N) {
+		zombies[i].setZombie(name);
+		i++;
+	}
+	return zombies;
+}

BIN
Module_01/ex01/.objects/Zombie.o


BIN
Module_01/ex01/.objects/main.o


BIN
Module_01/ex01/.objects/newZombie.o


BIN
Module_01/ex01/.objects/randomChump.o


BIN
Module_01/ex01/.objects/zombieHorde.o


+ 50 - 0
Module_01/ex01/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/15 14:44:55 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Zombie zombieHorde randomChump newZombie
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex01/ex00


+ 30 - 0
Module_01/ex01/includes/Zombie.hpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Zombie.hpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:42:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:47:35 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include <iostream>
+
+class	Zombie {
+	public:
+		Zombie(std::string name);
+		Zombie(void);
+		~Zombie(void);
+
+		void	announce(void) const;
+		void	setZombie(std::string name);
+
+	private:
+		std::string	_name;
+};
+
+Zombie	*newZombie( std::string name);
+void	randomChump( std::string name );
+Zombie	*zombieHorde( int N, std::string name );

+ 36 - 0
Module_01/ex01/srcs/Zombie.cpp

@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Zombie.cpp                                         :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:44:24 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:48:08 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+#include <iostream>
+
+Zombie::Zombie(std::string name) : _name(name) {
+	std::cout << "Constructor of " << name << "called" << std::endl;
+	return ;
+}
+
+Zombie::Zombie(void) : _name("defaultName") {
+	std::cout << "Constructor of " << this->_name << "called" << std::endl;
+	return ;
+}
+Zombie::~Zombie(void) {
+	std::cout << "Destructor of " << this->_name << "called" << std::endl;
+	return ;
+}
+
+void	Zombie::announce(void) const {
+	std::cout << this->_name << ": BraiiiiiiiinnnnzzzzZ..." << std::endl;
+}
+
+void	Zombie::setZombie(std::string name) {
+	this->_name = name;
+}

+ 27 - 0
Module_01/ex01/srcs/main.cpp

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 14:30:32 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:50:07 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+#include <iostream>
+
+int	main(void) {
+	
+	randomChump("testouille");
+	Zombie *ZombieTest = newZombie("tameouilr");
+
+	delete(ZombieTest);
+	ZombieTest = zombieHorde(4, "tameouilr2121");
+	for (int i = 0; i < 4; i++)
+		ZombieTest[i].announce();
+	delete [] ZombieTest;
+	return 0;
+}

+ 17 - 0
Module_01/ex01/srcs/newZombie.cpp

@@ -0,0 +1,17 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   newZombie.cpp                                      :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:51:00 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 13:56:23 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+Zombie	*newZombie(std::string name) {
+	return new	Zombie(name);
+}

+ 20 - 0
Module_01/ex01/srcs/randomChump.cpp

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   randomChump.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:56:38 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 13:58:18 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+void	randomChump(std::string name) {
+	Zombie	zombie(name);
+
+	zombie.announce();
+	return ;
+}

+ 25 - 0
Module_01/ex01/srcs/zombieHorde.cpp

@@ -0,0 +1,25 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   zombieHorde.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 13:58:41 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 14:30:26 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Zombie.hpp"
+
+Zombie	*zombieHorde(int N, std::string name) {
+	Zombie *zombies = new Zombie[N];
+	int i;
+
+	i = 0;
+	while (i < N) {
+		zombies[i].setZombie(name);
+		i++;
+	}
+	return zombies;
+}

BIN
Module_01/ex02/.objects/main.o


+ 50 - 0
Module_01/ex02/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/15 15:14:26 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex02/ex00


+ 30 - 0
Module_01/ex02/srcs/main.cpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 14:57:39 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 15:14:56 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include <iostream>
+
+int main(void) {
+	std::string	str = "HI THIS IS BRAIN";
+
+	std::string	*stringPTR = &str;
+	std::string	&stringREF = str;
+
+	std::cout << &str << " | str address" << std::endl;
+	std::cout << &stringPTR << " | stringPTR address" << std::endl;
+	std::cout << &stringREF << " | stringREF address" << std::endl;
+
+
+	std::cout << str << "| str value" << std::endl;
+	std::cout << *stringPTR << "| stringPTR value" << std::endl;
+	std::cout << stringREF << "| stringVAR value" << std::endl;
+	return 0;
+}

BIN
Module_01/ex03/.objects/HumanA.class.o


BIN
Module_01/ex03/.objects/HumanB.class.o


BIN
Module_01/ex03/.objects/Weapon.class.o


BIN
Module_01/ex03/.objects/main.o


+ 50 - 0
Module_01/ex03/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/15 16:12:37 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main HumanA.class HumanB.class Weapon.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex03/ex00


+ 31 - 0
Module_01/ex03/includes/HumanA.class.hpp

@@ -0,0 +1,31 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanA.class.hpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:37:01 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 18:13:28 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef HUMANA_CLASS_H
+#define HUMANA_CLASS_H
+
+#include <iostream>
+#include "Weapon.class.hpp"
+
+class	HumanA {
+	public:
+		HumanA(std::string name, Weapon &weapon);
+		~HumanA(void);
+
+		void	attack(void) const;
+
+	private:
+		std::string	_name;
+		Weapon		&_weapon;
+};
+
+#endif

+ 32 - 0
Module_01/ex03/includes/HumanB.class.hpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanB.class.hpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:37:01 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 18:12:13 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef HUMANB_CLASS_H
+#define HUMANB_CLASS_H
+
+#include <iostream>
+#include "Weapon.class.hpp"
+
+class	HumanB {
+	public:
+		HumanB(std::string name);
+		~HumanB(void);
+
+		void	attack(void) const;
+		void	setWeapon(Weapon &weapon);
+
+	private:
+		std::string	_name;
+		Weapon		*_weapon;
+};
+
+#endif

+ 30 - 0
Module_01/ex03/includes/Weapon.class.hpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Weapon.class.hpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:34:27 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 17:10:48 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef WEAPON_CLASS_H
+#define WEAPON_CLASS_H
+
+#include <iostream>
+
+class	Weapon {
+	public:
+		Weapon(std::string type);
+		~Weapon(void);
+
+		std::string	getType(void) const;
+		void		setType(std::string type);
+	
+	private:
+		std::string	_type;
+};
+
+#endif

+ 27 - 0
Module_01/ex03/srcs/HumanA.class.cpp

@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanA.class.cpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:54:21 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 18:13:42 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "HumanA.class.hpp"
+#include "Weapon.class.hpp"
+#include <iostream>
+
+HumanA::HumanA(std::string name, Weapon &weapon) : _name(name), _weapon(weapon) {
+	return ;
+}
+
+HumanA::~HumanA(void) {
+	return ;
+}
+
+void	HumanA::attack(void) const {
+	std::cout << this->_name << " attacks with their " << this->_weapon.getType() << std::endl;
+}

+ 32 - 0
Module_01/ex03/srcs/HumanB.class.cpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   HumanB.class.cpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:54:21 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 18:12:20 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "HumanB.class.hpp"
+#include <iostream>
+
+HumanB::HumanB(std::string name) : _name(name) {
+	return ;
+}
+
+
+HumanB::~HumanB(void) {
+	return ;
+}
+
+void	HumanB::attack(void) const {
+	std::cout << this->_name << " attacks with their " << this->_weapon->getType() << std::endl;
+}
+
+void	HumanB::setWeapon(Weapon &weapon) {
+	this->_weapon = &weapon;
+	return;
+}

+ 30 - 0
Module_01/ex03/srcs/Weapon.class.cpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Weapon.class.cpp                                   :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 15:48:04 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 16:46:07 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Weapon.class.hpp"
+
+Weapon::Weapon(std::string type) : _type(type) {
+	return;
+}
+
+Weapon::~Weapon(void) {
+	return ;
+}
+
+std::string	Weapon::getType(void) const {
+	return this->_type;
+}
+
+void		Weapon::setType(std::string type) {
+	this->_type = type;
+	return ;
+}

+ 35 - 0
Module_01/ex03/srcs/main.cpp

@@ -0,0 +1,35 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 16:42:34 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 16:43:49 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "HumanA.class.hpp"
+#include "HumanB.class.hpp"
+#include "Weapon.class.hpp"
+
+int main()
+{
+	{
+		Weapon club = Weapon("crude spiked club");
+		HumanA bob("Bob", club);
+		bob.attack();
+		club.setType("some other type of club");
+		bob.attack();
+	}
+	{
+		Weapon club = Weapon("crude spiked club");
+		HumanB jim("Jim");
+		jim.setWeapon(club);
+		jim.attack();
+		club.setType("some other type of club");
+		jim.attack();
+	}
+	return 0;
+}

BIN
Module_01/ex03/weapon.tar.gz


BIN
Module_01/ex04/.objects/main.o


+ 50 - 0
Module_01/ex04/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/15 18:41:52 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex04/ex00


+ 34 - 0
Module_01/ex04/srcs/main.cpp

@@ -0,0 +1,34 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 18:21:32 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 19:35:30 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include <iostream>
+#include <fstream>
+#include <regex>
+
+int main(int ac, char **av) {
+	
+	std::string	line;
+
+	if (ac < 3)
+		return 1;
+
+	std::ifstream	ifs(av[1]);
+	std::string		out_name = av[1];
+	std::ofstream	ofs(out_name.append(".replace"));
+
+	while (std::getline(ifs, line)) {
+		ofs << std::regex_replace(line, std::regex(av[2]), av[3]) << std::endl;
+	}
+	ifs.close();
+	ofs.close();
+	return 0;
+}

+ 34 - 0
Module_01/ex04/srcs/main.cpp.replace

@@ -0,0 +1,34 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 18:21:32 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/15 19:35:30 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#wafuuu <iostream>
+#wafuuu <fstream>
+#wafuuu <regex>
+
+int main(int ac, char **av) {
+	
+	std::string	line;
+
+	if (ac < 3)
+		return 1;
+
+	std::ifstream	ifs(av[1]);
+	std::string		out_name = av[1];
+	std::ofstream	ofs(out_name.append(".replace"));
+
+	while (std::getline(ifs, line)) {
+		ofs << std::regex_replace(line, std::regex(av[2]), av[3]) << std::endl;
+	}
+	ifs.close();
+	ofs.close();
+	return 0;
+}

+ 3 - 0
Module_01/ex04/test

@@ -0,0 +1,3 @@
+bla bla bloop bloop
+bli bla blou
+badioup ap

+ 3 - 0
Module_01/ex04/test.replace

@@ -0,0 +1,3 @@
+boooo boooo bloop bloop
+bli boooo blou
+badioup ap

BIN
Module_01/ex05/.objects/harl.class.o


BIN
Module_01/ex05/.objects/main.o


+ 50 - 0
Module_01/ex05/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/16 11:48:29 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main harl.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex05/ex00


+ 30 - 0
Module_01/ex05/includes/harl.class.hpp

@@ -0,0 +1,30 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   harl.class.hpp                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 19:42:56 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 12:10:19 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+
+#ifndef HARL_CLASS_H
+# define HARL_CLASS_H
+
+#include <iostream>
+
+class	Harl {
+	private:
+		void	debug(void);
+		void	info(void);
+		void	warning(void);
+		void	error(void);
+
+	public:
+		void	complain(std::string level);
+};
+
+#endif

+ 45 - 0
Module_01/ex05/srcs/harl.class.cpp

@@ -0,0 +1,45 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   harl.class.cpp                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 19:49:59 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 13:29:14 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "harl.class.hpp"
+
+void	Harl::debug(void) {
+	std::cout << "[DEBUG] I love having extra bacon for my 7XL-double-cheese-triple-pickle-special-ketchup burger. I really do!" << std::endl;
+}
+
+void	Harl::info(void) {
+	std::cout << "[INFO] I cannot believe adding extra bacon costs more money. You didn’t put enough bacon in my burger! If you did, I wouldn’t be asking for more!" << std::endl;
+}
+
+void	Harl::warning(void) {
+	std::cout << "[WARNING] I think I deserve to have some extra bacon for free. I’ve been coming for years, whereas you started working here just last month." << std::endl;
+}
+
+void	Harl::error(void) {
+	std::cout << "[ERROR] This is unacceptable! I want to speak to the manager now." << std::endl;
+}
+
+void	Harl::complain(std::string level) {
+	void		(Harl::*fn[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
+	std::string	complain[] = {"DEBUG", "INFO", "WARNING", "ERROR"};
+	int			i;
+	bool		print = false;
+
+	i = 0;
+	while (i < 4) {
+		if (complain[i].compare(level) == 0 || print) {
+			print = true;
+			(this->*fn[i])();
+		}
+		i++;
+	}
+}

+ 20 - 0
Module_01/ex05/srcs/main.cpp

@@ -0,0 +1,20 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/16 11:45:53 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 11:48:15 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "harl.class.hpp"
+
+int main(void) {
+	Harl	harl;
+
+	harl.complain("WARNING");
+	return 0;
+}

BIN
Module_01/ex06/.objects/harl.class.o


BIN
Module_01/ex06/.objects/main.o


+ 50 - 0
Module_01/ex06/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/16 11:48:29 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main harl.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_01/ex06/ex00


+ 32 - 0
Module_01/ex06/includes/harl.class.hpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   harl.class.hpp                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 19:42:56 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 13:16:06 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+
+#ifndef HARL_CLASS_H
+# define HARL_CLASS_H
+
+#include <iostream>
+#include <array>
+
+class	Harl {
+	private:
+		void	debug(void);
+		void	info(void);
+		void	warning(void);
+		void	error(void);
+
+	public:
+		void	complain(std::string level);
+		static std::array<std::string, 4>	getLevels(void);
+};
+
+#endif

+ 50 - 0
Module_01/ex06/srcs/harl.class.cpp

@@ -0,0 +1,50 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   harl.class.cpp                                     :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/15 19:49:59 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 13:18:36 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "harl.class.hpp"
+
+void	Harl::debug(void) {
+	std::cout << "[DEBUG] I love having extra bacon for my 7XL-double-cheese-triple-pickle-special-ketchup burger. I really do!" << std::endl;
+}
+
+void	Harl::info(void) {
+	std::cout << "[INFO] I cannot believe adding extra bacon costs more money. You didn’t put enough bacon in my burger! If you did, I wouldn’t be asking for more!" << std::endl;
+}
+
+void	Harl::warning(void) {
+	std::cout << "[WARNING] I think I deserve to have some extra bacon for free. I’ve been coming for years, whereas you started working here just last month." << std::endl;
+}
+
+void	Harl::error(void) {
+	std::cout << "[ERROR] This is unacceptable! I want to speak to the manager now." << std::endl;
+}
+
+
+std::array<std::string, 4>	Harl::getLevels(void) {
+	return {"DEBUG", "INFO", "WARNING", "ERROR"};
+}
+
+void	Harl::complain(std::string level) {
+	void		(Harl::*fn[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
+	std::array<std::string, 4> complain = Harl::getLevels();
+	int			i;
+	bool		print = false;
+
+	i = 0;
+	while (i < 4) {
+		if (complain[i].compare(level) == 0 || print) {
+			print = true;
+			(this->*fn[i])();
+		}
+		i++;
+	}
+}

+ 28 - 0
Module_01/ex06/srcs/main.cpp

@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/16 11:45:53 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/16 13:15:46 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "harl.class.hpp"
+
+int main(int ac, char **av) {
+	std::array<std::string, 4> levels = Harl::getLevels();
+	Harl	harl;
+
+	if (ac > 1) {
+		for (int i = 0; i < 4; i++)
+			if (levels[i].compare(av[1])) {
+				harl.complain(av[1]);
+				return 0;
+			}
+	}
+	std::cout << "[ Probably complaining about insignificant problems ]" << std::endl;
+	return 0;
+}

BIN
Module_02/ex00/.objects/Fixed.class.o


BIN
Module_02/ex00/.objects/main.o


+ 50 - 0
Module_02/ex00/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/17 15:11:48 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Fixed.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_02/ex00/ex00


+ 32 - 0
Module_02/ex00/includes/Fixed.class.hpp

@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Fixed.class.hpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/16 15:46:39 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/17 15:24:37 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FIXED_CLASS_H
+# define FIXED_CLASS_H
+
+class	Fixed {
+	public:
+		Fixed(void);
+		Fixed(Fixed const &src);
+		~Fixed(void);
+
+		int			getRawBits(void) const;
+		void		setRawBits(int const raw);
+
+		Fixed		&operator=(Fixed const &rhs);
+
+	private:
+		int			_value;
+		int const	_integer;
+};
+
+#endif

+ 47 - 0
Module_02/ex00/srcs/Fixed.class.cpp

@@ -0,0 +1,47 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Fixed.class.cpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/16 16:07:34 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/17 15:33:54 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Fixed.class.hpp"
+#include <iostream>
+
+Fixed::Fixed(void) : _value(0), _integer(8) {
+	std::cout << "Default constructor called" << std::endl;
+	return ;
+}
+
+Fixed::Fixed(Fixed const &src) : _integer(8) {
+	*this = src;
+	std::cout << "Copy constructor called" << std::endl;
+	return ;
+}
+
+Fixed::~Fixed(void) {
+	std::cout << "Destructor called" << std::endl;
+	return ;
+}
+
+int	Fixed::getRawBits(void) const {
+	std::cout << "getRawBits member function called" << std::endl;
+	return this->_value;
+}
+
+void	Fixed::setRawBits(int const raw) {
+	std::cout << "setRawBits member function called" << std::endl;
+	this->_value = raw;
+	return ;
+}
+
+Fixed				&Fixed::operator=(Fixed const &rhs) {
+	std::cout << "Copy assignment operator called" << std::endl;
+	this->_value = rhs.getRawBits();
+	return *this;
+}

+ 28 - 0
Module_02/ex00/srcs/main.cpp

@@ -0,0 +1,28 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   main.cpp                                           :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/17 15:10:40 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/17 15:11:09 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#include "Fixed.class.hpp"
+
+#include <iostream>
+
+int main( void ) {
+	Fixed a;
+	Fixed b( a );
+	Fixed c;
+
+	c = b;
+	std::cout << a.getRawBits() << std::endl;
+	std::cout << b.getRawBits() << std::endl;
+	std::cout << c.getRawBits() << std::endl;
+
+	return 0;
+}

BIN
Module_02/ex01/.objects/Fixed.class.o


BIN
Module_02/ex01/.objects/main.o


+ 50 - 0
Module_02/ex01/Makefile

@@ -0,0 +1,50 @@
+#******************************************************************************#
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    Makefile                                           :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: bchanot <bchanot@students.42.fr>           +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2016/07/24 00:00:08 by bchanot           #+#    #+#              #
+#*   Updated: 2025/07/17 15:11:48 by bchanot          ###   ########.fr       *#
+#                                                                              #
+#******************************************************************************#
+
+NAME = ex00
+MAKE_LIBS = make --no-print-directory
+SRCS_DIR = srcs/
+OBJS_DIR = .objects/
+CC = g++ -Wall -Wextra -Werror -g
+INC = -I./includes
+FILES = main Fixed.class
+SRCS = $(FILES)
+OBJS = $(addprefix $(OBJS_DIR), $(addsuffix .o, $(SRCS)))
+RED = \033[1;31m
+BLUE = \033[1;34m
+CYAN = \033[0;36m
+GREEN = \033[1;32m
+YELLOW = \033[1;33m
+EOC = \033[0m
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+	@echo -e "$(GREEN)Objects created.$(EOC)"
+	@$(CC) $(OBJS) $(INC) -o $(NAME)
+	@echo -e "$(GREEN)Compilation complete.$(EOC)"
+
+$(OBJS_DIR)%.o: $(SRCS_DIR)%.cpp
+	@mkdir -p $(dir $@)
+	$(CC) -c $< $(INC) -o $@
+
+clean:
+	@echo -e "$(RED)Deleting objects.$(EOC)"
+	@/bin/rm -rf $(OBJS_DIR)
+
+fclean: clean
+	@echo -e "$(RED)Deleting binary.$(EOC)"
+	@/bin/rm -rf $(NAME)
+
+re: fclean all
+
+.PHONY: all clean fclean re

BIN
Module_02/ex01/ex00


+ 40 - 0
Module_02/ex01/includes/Fixed.class.hpp

@@ -0,0 +1,40 @@
+/* ************************************************************************** */
+/*                                                                            */
+/*                                                        :::      ::::::::   */
+/*   Fixed.class.hpp                                    :+:      :+:    :+:   */
+/*                                                    +:+ +:+         +:+     */
+/*   By: bchanot <bchanot@gmail.fr>                 +#+  +:+       +#+        */
+/*                                                +#+#+#+#+#+   +#+           */
+/*   Created: 2025/07/16 15:46:39 by bchanot           #+#    #+#             */
+/*   Updated: 2025/07/17 17:16:03 by bchanot          ###   ########.fr       */
+/*                                                                            */
+/* ************************************************************************** */
+
+#ifndef FIXED_CLASS_H
+# define FIXED_CLASS_H
+
+#include <iostream>
+
+class	Fixed {
+	public:
+		Fixed(void);
+		Fixed(Fixed const &src);
+		Fixed(int const num);
+		Fixed(float const num);
+		~Fixed(void);
+
+		int			getRawBits(void) const;
+		void		setRawBits(int const raw);
+		float		toFloat(void) const;
+		int			toInt(void) const;
+
+		Fixed		&operator=(Fixed const &rhs);
+
+	private:
+		int			_value;
+		static int const	_frac = 8;
+};
+
+std::ostream	&operator<<(std::ostream &o, Fixed const &i);
+
+#endif

Vissa filer visades inte eftersom för många filer har ändrats