「🏗️」 wip(Unnecessary violence): Started ex03
This commit is contained in:
@ -6,16 +6,18 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 10:52:33 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 14:49:24 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/11/04 19:21:59 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class Zombie {
|
||||
private:
|
||||
std::string name;
|
||||
|
||||
public:
|
||||
void announce(void);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 10:52:33 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 18:54:32 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/11/04 19:22:07 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
class Zombie {
|
||||
private:
|
||||
std::string name;
|
||||
|
||||
public:
|
||||
void announce(void);
|
||||
void setName(std::string newName);
|
||||
|
18
ex03/HumanA.cpp
Normal file
18
ex03/HumanA.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* HumanA.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:41:23 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:42:58 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <iostream>
|
||||
#include "HumanA.hpp"
|
||||
|
||||
void HumanA::attack(void) {
|
||||
std::cout << this->name << " attacks with their " << this->weapon.getType() << std::endl;
|
||||
}
|
25
ex03/HumanA.hpp
Normal file
25
ex03/HumanA.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* HumanA.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:36:00 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:40:02 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Weapon.hpp"
|
||||
#include <string>
|
||||
|
||||
class HumanA {
|
||||
private:
|
||||
std::string name;
|
||||
Weapon weapon;
|
||||
|
||||
public:
|
||||
void attack(void);
|
||||
};
|
22
ex03/HumanB.cpp
Normal file
22
ex03/HumanB.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* HumanB.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:43:18 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:50:18 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "HumanB.hpp"
|
||||
#include <iostream>
|
||||
|
||||
void HumanB::attack(void) {
|
||||
std::cout << this->name << " attacks with their " << this->weapon.getType() << std::endl;
|
||||
}
|
||||
|
||||
void HumanB::setWeapon(Weapon newWeapon) {
|
||||
this->weapon = newWeapon;
|
||||
}
|
26
ex03/HumanB.hpp
Normal file
26
ex03/HumanB.hpp
Normal file
@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* HumanB.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:39:47 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:50:19 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Weapon.hpp"
|
||||
#include <string>
|
||||
|
||||
class HumanB {
|
||||
private:
|
||||
std::string name;
|
||||
Weapon weapon;
|
||||
|
||||
public:
|
||||
void attack(void);
|
||||
void setWeapon(Weapon newWeapon);
|
||||
};
|
54
ex03/Makefile
Normal file
54
ex03/Makefile
Normal file
@ -0,0 +1,54 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
|
||||
# Updated: 2024/11/04 19:17:30 by adjoly ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
NAME = violence
|
||||
|
||||
CC = c++
|
||||
|
||||
OBJSDIR = obj/
|
||||
|
||||
SRCS = main.cpp
|
||||
|
||||
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o))
|
||||
|
||||
FLAGS = -Wall -Werror -Wextra -std=c++98 -MMD -MP
|
||||
|
||||
RED = \033[0;31m
|
||||
GREEN = \033[0;32m
|
||||
YELLOW = \033[1;33m
|
||||
PURPLE = \e[0;35m
|
||||
NC = \033[0m
|
||||
DELETE = \x1B[2K\r
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
@$(CC) $(FLAGS) $(OBJS) -o $(NAME)
|
||||
@printf "$(YELLOW)「✨」($(NAME)) Program compiled\n"
|
||||
|
||||
$(OBJSDIR)%.o: %.cpp
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) $(FLAGS) -c $< -o $@
|
||||
@printf "$(DELETE)$(GREEN)「🔨」($<) Object compiled\n"
|
||||
|
||||
clean:
|
||||
@rm -f $(OBJS)
|
||||
@printf "$(DELETE)$(RED)「🗑️」($(OBJS)) Object deleted\n"
|
||||
|
||||
fclean: clean
|
||||
@rm -f $(NAME)
|
||||
@rm -Rf $(OBJSDIR)
|
||||
@printf "$(RED)「🗑️」($(NAME)) Program deleted\n"
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: clean fclean all re
|
21
ex03/Weapon.cpp
Normal file
21
ex03/Weapon.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Weapon.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:23:35 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:34:02 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "Weapon.hpp"
|
||||
|
||||
void Weapon::setType(std::string newType) {
|
||||
this->type = newType;
|
||||
}
|
||||
|
||||
std::string Weapon::getType(void) {
|
||||
return (this->type);
|
||||
}
|
24
ex03/Weapon.hpp
Normal file
24
ex03/Weapon.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Weapon.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:21:24 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:23:25 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class Weapon {
|
||||
private:
|
||||
std::string type;
|
||||
|
||||
public:
|
||||
std::string getType(void);
|
||||
void setType(std::string newType);
|
||||
};
|
15
ex03/main.cpp
Normal file
15
ex03/main.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.cpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/04 19:20:57 by adjoly #+# #+# */
|
||||
/* Updated: 2024/11/04 19:21:10 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
int main(void) {
|
||||
|
||||
}
|
Reference in New Issue
Block a user