From ec713f85282ee97ed0b979083d80ee868d73e858 Mon Sep 17 00:00:00 2001 From: adjoly Date: Mon, 14 Apr 2025 20:47:58 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8E=89=E3=80=8D=20init:=20starte?= =?UTF-8?q?d=20span?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .clang-format | 5 +++++ ex01/Makefile | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ ex01/Span.cpp | 0 ex01/Span.hpp | 25 +++++++++++++++++++++ ex01/main.cpp | 0 5 files changed, 90 insertions(+) create mode 100644 .clang-format create mode 100644 ex01/Makefile create mode 100644 ex01/Span.cpp create mode 100644 ex01/Span.hpp create mode 100644 ex01/main.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..7a2deec --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +UseTab: Always +IndentWidth: 4 +TabWidth: 4 +AlignConsecutiveDeclarations: true +ConstructorInitializerIndentWidth: 4 diff --git a/ex01/Makefile b/ex01/Makefile new file mode 100644 index 0000000..7225175 --- /dev/null +++ b/ex01/Makefile @@ -0,0 +1,60 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: adjoly +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2024/10/25 16:09:27 by adjoly #+# #+# # +# Updated: 2025/04/14 19:06:23 by adjoly ### ########.fr # +# # +# **************************************************************************** # + +SHELL = bash + +NAME = easyfind + +CC = c++ + +OBJSDIR = obj/ + +SRCS = $(shell find . -name '*.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 + +ifeq ($(VERBOSE),true) + FLAGS += -D VERBOSE +endif + +all: $(NAME) + +$(NAME): $(OBJS) + @$(CC) $(FLAGS) -I . $(OBJS) -o $(NAME) + @printf "$(YELLOW)「✨」($(NAME)) Program compiled\n" + +$(OBJSDIR)%.o: %.cpp + @mkdir -p $(@D) + @$(CC) $(FLAGS) -I . -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/ex01/Span.cpp b/ex01/Span.cpp new file mode 100644 index 0000000..e69de29 diff --git a/ex01/Span.hpp b/ex01/Span.hpp new file mode 100644 index 0000000..3938ca1 --- /dev/null +++ b/ex01/Span.hpp @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Span.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/04/14 19:54:33 by adjoly #+# #+# */ +/* Updated: 2025/04/14 20:09:51 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +class Span { + public: + Span(unsigned int); + ~Span(void); + + void addNumber(int); + + int shortestSpan(void); + int longestSpan(void); + private: +}; diff --git a/ex01/main.cpp b/ex01/main.cpp new file mode 100644 index 0000000..e69de29