This commit is contained in:
Angel Ortigosa Perez
2025-09-07 10:03:17 +02:00
commit 859690063b
30 changed files with 846 additions and 0 deletions

33
ex01/Zombie/Zombie.cpp Normal file
View File

@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Zombie.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/05 16:46:34 by aortigos #+# #+# */
/* Updated: 2025/09/06 01:36:29 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "Zombie.hpp"
Zombie::Zombie()
{
this->name = "NULL";
}
Zombie::~Zombie()
{
std::cout << this->name << " has died.... again..." << std::endl;
}
void Zombie::setName(std::string str)
{
this->name = str;
}
void Zombie::announce( void )
{
std::cout << this->name << ": BraiiiiiiinnnzzzZ..." << std::endl;
}

33
ex01/Zombie/Zombie.hpp Normal file
View File

@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Zombie.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/05 16:44:08 by aortigos #+# #+# */
/* Updated: 2025/09/06 01:36:21 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef ZOMBIE_HPP
# define ZOMBIE_HPP
# include <iostream>
class Zombie
{
private:
std::string name;
public:
Zombie();
~Zombie();
void setName( std::string str );
void announce( void );
};
Zombie* zombieHorde( int N, std::string name );
#endif

View File

@@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* zombieHorde.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/05 17:04:19 by aortigos #+# #+# */
/* Updated: 2025/09/06 01:47:44 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "Zombie.hpp"
Zombie* zombieHorde( int N, std::string name )
{
Zombie *z = new Zombie[N];
int i;
i = 0;
while (i < N)
z[i++].setName(name);
return (z);
}