「✨」 feat(Hi this is a brain): Finished ex02
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@ compile_commands.json
|
|||||||
flake.lock
|
flake.lock
|
||||||
zombie
|
zombie
|
||||||
zombieHorde
|
zombieHorde
|
||||||
|
thisisabrain
|
||||||
|
violence
|
||||||
|
54
ex02/Makefile
Normal file
54
ex02/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: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
|
30
ex02/main.cpp
Normal file
30
ex02/main.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* main.cpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/11/04 19:01:36 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2024/11/04 19:15:33 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
Reference in New Issue
Block a user