This commit is contained in:
Ladebeze66
2024-03-06 17:19:47 +01:00
parent e80766919d
commit 4438d4f930
8 changed files with 117 additions and 9 deletions

61
cpp09/ex02/Makefile Normal file
View File

@@ -0,0 +1,61 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/12/27 20:57:42 by fgras-ca #+# #+# #
# Updated: 2024/03/06 15:58:19 by fgras-ca ### ########.fr #
# #
# **************************************************************************** #
LOGO = @echo "🅻🅰🅳🅴🅱🅴🆉🅴";\
DEF_COLOR = \033[0m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
ORANGE = \033[38;5;214m
NAME = pmergeme
SRC = main.cpp \
PmergeMe.cpp \
CC = c++
CFLAGS = -Wall -Werror -Wextra -std=c++98
RM = rm -f
OBJS = ${SRC:.cpp=.o}
all : $(NAME)
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
$(NAME) : $(OBJS)
@echo "$(RED)Compilation fixed... $(DEF_COLOR)"
$(CC) $(CFLAGS) $(OBJS) -g -o $(NAME)
@echo "$(GREEN)Compilation complete. $(ORANGE)Type "./pmergeme" to execute the program!!$(DEF_COLOR)"
$(LOGO)
clean :
@echo "$(RED)Deleating files objects... $(DEF_COLOR)"
$(RM) $(OBJS)
@echo "$(GREEN)files deleted!! $(DEF_COLOR)"
$(LOGO)
fclean : clean
@echo "$(RED)Delete program name... $(DEF_COLOR)"
$(RM) $(NAME)
@echo "$(GREEN)File program deleted!! $(DEF_COLOR)"
$(LOGO)
re : fclean all
.PHONY : all clean fclean re

0
cpp09/ex02/PmergeMe.cpp Normal file
View File

42
cpp09/ex02/PmergeMe.hpp Normal file
View File

@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PmergeMe.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/06 16:17:28 by fgras-ca #+# #+# */
/* Updated: 2024/03/06 17:18:48 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PMERGEME_HPP
#define PMERGEME_HPP
#include <vector>
#include <list>
#include <string>
class PmergeMe
{
public:
PmergeMe();
~PmergeMe();
PmergeMe(const PmergeMe& other);
PmergeMe& operator=(const PmergeMe& other);
void sortAndDisplay(const std::vector<int>& input);
void sortAndDisplay(const std::list<int>& input);
private:
template<typename Container>
void forJohnsonSort(Container& container);
template<typename Container>
void displaySequence(const Container& sequence, const std::string& prefix);
template<typename Container>
void mesureAndSort(Container& container);
};
#endif

0
cpp09/ex02/main.cpp Normal file
View File