diff --git a/.gitignore b/.gitignore index 90c63de..66599d1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ compile_commands.json flake.lock zombie zombieHorde +thisisabrain +violence diff --git a/ex02/Makefile b/ex02/Makefile new file mode 100644 index 0000000..624f674 --- /dev/null +++ b/ex02/Makefile @@ -0,0 +1,54 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: adjoly +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2024/10/25 16:09:27 by adjoly #+# #+# # +# Updated: 2024/11/04 19:17:46 by adjoly ### ########.fr # +# # +# **************************************************************************** # + +NAME = thisisabrain + +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 diff --git a/ex02/main.cpp b/ex02/main.cpp new file mode 100644 index 0000000..2c40a37 --- /dev/null +++ b/ex02/main.cpp @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/11/04 19:01:36 by adjoly #+# #+# */ +/* Updated: 2024/11/04 19:15:33 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include + +int main(void) { + std::string str = "HI THIS IS BRAIN"; + std::string *stringPTR = &str; + std::string &stringREF = str; + + std::cout << "The address of the string : " << &str << std::endl; + std::cout << "The address of the string pointer : " << stringPTR << std::endl; + std::cout << "The address of the string reference : " << &stringREF << std::endl; + + std::cout << std::endl; + + std::cout << "The value of the string : " << str << std::endl; + std::cout << "The value pointed to by stringPTR : " << *stringPTR << std::endl; + std::cout << "The value pointed to by stringREF : " << stringREF << std::endl; +}