commit e1694a698d2b9a52906aeb2f55c571273ef1f04f Author: Raphaƫl <35407363+EniumRaphael@users.noreply.github.com> Date: Sat Sep 21 14:14:03 2024 +0200 Add files via upload diff --git a/cpp00/ex00/Makefile b/cpp00/ex00/Makefile new file mode 100644 index 0000000..2e8a5a6 --- /dev/null +++ b/cpp00/ex00/Makefile @@ -0,0 +1,112 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2024/08/19 20:13:41 by rparodi ### ########.fr # +# # +# **************************************************************************** # + + +# Variables + +# Name +NAME = megaphone + +# Commands +CXX = c++ +RM = rm -rf + +# Flags +CXXFLAGS = -Werror -Wextra -Wall -std=c++98 -g3 + +# Sources +SRC = megaphone.cpp + +# Objects +OBJDIRNAME = ./build +OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.cpp=.o)) + +# Colors +GREEN = \033[32m +GREY = \033[0;90m +RED = \033[0;31m +GOLD = \033[38;5;220m +END = \033[0m + +# Rules + +# All (make all) +all: header $(NAME) footer + +# Bonus (make bonus) +bonus: header $(OBJ) footer + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Clean (make clean) +clean: + @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' + @printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n' + @$(RM) $(OBJDIRNAME) + +# Clean (make fclean) +fclean: clean + @printf '$(GREY) Removing $(END)$(RED)Program$(END)\n' + @$(RM) $(NAME) + @echo "" + +# Restart (make re) +re: header fclean all + +# Dependences for all +$(NAME): $(OBJ) + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Creating the objects +$(OBJDIRNAME)/%.o: %.cpp + @mkdir -p $(dir $@) + @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' + @$(CXX) $(CXXFLAGS) -o $@ -c $< + +# Header +header: + @clear + @printf '\n\n' + @printf '$(GOLD) ******* ****** ******* $(END)\n' + @printf '$(GOLD) ****** *** ******* $(END)\n' + @printf '$(GOLD) ******* * ******* $(END)\n' + @printf '$(GOLD) ****** ******* $(END)\n' + @printf '$(GOLD) ******* ******* $(END)\n' + @printf '$(GOLD) ******************* ******* * $(END)\n' + @printf '$(GOLD) ******************* ******* *** $(END)\n' + @printf '$(GOLD) ****** ******* ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GREY) Made by rparodi$(END)\n\n' + +# Footer +footer: + @printf "\n" + @printf "$(GOLD) ,_ _,$(END)\n" + @printf "$(GOLD) | \\___//|$(END)\n" + @printf "$(GOLD) |=6 6=|$(END)\n" + @printf "$(GOLD) \\=._Y_.=/$(END)\n" + @printf "$(GOLD) ) \` ( ,$(END)\n" + @printf "$(GOLD) / \\ (('$(END)\n" + @printf "$(GOLD) | | ))$(END)\n" + @printf "$(GOLD) /| | | |\\_//$(END)\n" + @printf "$(GOLD) \\| |._.| |/-\`$(END)\n" + @printf "$(GOLD) '\"' '\"'$(END)\n" + @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' + +# Phony +.PHONY: all bonus clean fclean re + +-include ${OBJ:.o=.d} diff --git a/cpp00/ex00/megaphone.cpp b/cpp00/ex00/megaphone.cpp new file mode 100644 index 0000000..904a992 --- /dev/null +++ b/cpp00/ex00/megaphone.cpp @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* megaphone.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/08/06 16:08:46 by rparodi #+# #+# */ +/* Updated: 2024/09/03 18:22:21 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include + +std::string str_toupper(std::string str) +{ + for (size_t i = 0; str[i] != '\0'; i++) + str[i] = std::toupper(str[i]); + return (str); +} + +int main(int argc, char *argv[]) +{ + if (argc > 1) + { + for (int i = 1; i < argc; i++){ + std::cout << str_toupper(argv[i]); + if (i + 1 != argc) + std::cout << " "; + } + } + else + std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *"; + std::cout << std::endl; + return (0); +} diff --git a/cpp00/ex01/Makefile b/cpp00/ex01/Makefile new file mode 100644 index 0000000..5902629 --- /dev/null +++ b/cpp00/ex01/Makefile @@ -0,0 +1,112 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2024/09/20 19:46:50 by rparodi ### ########.fr # +# # +# **************************************************************************** # + + +# Variables + +# Name +NAME = phonebook + +# Commands +CXX = c++ +RM = rm -rf + +# Flags +CXXFLAGS = -Werror -Wextra -Wall -std=c++98 -g3 + +# Sources +SRC = ./main.cpp + +# Objects +OBJDIRNAME = ./build +OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.cpp=.o)) + +# Colors +GREEN = \033[32m +GREY = \033[0;90m +RED = \033[0;31m +GOLD = \033[38;5;220m +END = \033[0m + +# Rules + +# All (make all) +all: header $(NAME) footer + +# Bonus (make bonus) +bonus: header $(OBJ) footer + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Clean (make clean) +clean: + @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' + @printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n' + @$(RM) $(OBJDIRNAME) + +# Clean (make fclean) +fclean: clean + @printf '$(GREY) Removing $(END)$(RED)Program$(END)\n' + @$(RM) $(NAME) + @echo "" + +# Restart (make re) +re: header fclean all + +# Dependences for all +$(NAME): $(OBJ) + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Creating the objects +$(OBJDIRNAME)/%.o: %.cpp + @mkdir -p $(dir $@) + @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' + @$(CXX) $(CXXFLAGS) -o $@ -c $< + +# Header +header: + @clear + @printf '\n\n' + @printf '$(GOLD) ******* ****** ******* $(END)\n' + @printf '$(GOLD) ****** *** ******* $(END)\n' + @printf '$(GOLD) ******* * ******* $(END)\n' + @printf '$(GOLD) ****** ******* $(END)\n' + @printf '$(GOLD) ******* ******* $(END)\n' + @printf '$(GOLD) ******************* ******* * $(END)\n' + @printf '$(GOLD) ******************* ******* *** $(END)\n' + @printf '$(GOLD) ****** ******* ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GREY) Made by rparodi$(END)\n\n' + +# Footer +footer: + @printf "\n" + @printf "$(GOLD) ,_ _,$(END)\n" + @printf "$(GOLD) | \\___//|$(END)\n" + @printf "$(GOLD) |=6 6=|$(END)\n" + @printf "$(GOLD) \\=._Y_.=/$(END)\n" + @printf "$(GOLD) ) \` ( ,$(END)\n" + @printf "$(GOLD) / \\ (('$(END)\n" + @printf "$(GOLD) | | ))$(END)\n" + @printf "$(GOLD) /| | | |\\_//$(END)\n" + @printf "$(GOLD) \\| |._.| |/-\`$(END)\n" + @printf "$(GOLD) '\"' '\"'$(END)\n" + @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' + +# Phony +.PHONY: all bonus clean fclean re + +-include ${OBJ:.o=.d} diff --git a/cpp00/ex01/main.cpp b/cpp00/ex01/main.cpp new file mode 100644 index 0000000..5139ea9 --- /dev/null +++ b/cpp00/ex01/main.cpp @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/20 19:42:14 by rparodi #+# #+# */ +/* Updated: 2024/09/20 20:03:13 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "./phonebook.h" +#include +#include + +bool adding(int index); + +int main(void) +{ + contact array_contact[8]; + int i; + std::string input; + + std::getline(std::cout, input, ':'); + if (strcmp(input.data, "ADD:")) + adding(i); + if (strcmp(input[i].data, "SEARCH:")) + array_contact.print(); + if (strcmp(input.data, "EXIT:")) + return (0); +} diff --git a/cpp00/ex01/phonebook b/cpp00/ex01/phonebook new file mode 100644 index 0000000..7068b99 Binary files /dev/null and b/cpp00/ex01/phonebook differ diff --git a/cpp00/ex01/phonebook.cpp b/cpp00/ex01/phonebook.cpp new file mode 100644 index 0000000..f615e94 --- /dev/null +++ b/cpp00/ex01/phonebook.cpp @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* phonebook.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/20 19:50:03 by rparodi #+# #+# */ +/* Updated: 2024/09/20 19:50:51 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "phonebook.h" + +void contact::print(void) { + std::cout << "First Name:" << first_name << std::endl; + std::cout << "Last Name:" << last_name << std::endl; + std::cout << "Nickname:" << nickname << std::endl; + std::cout << "Number:" << number << std::endl; + std::cout << "ID:" << id << std::endl; +} + diff --git a/cpp00/ex01/phonebook.h b/cpp00/ex01/phonebook.h new file mode 100644 index 0000000..4162319 --- /dev/null +++ b/cpp00/ex01/phonebook.h @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* phonebook.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/09/20 18:59:14 by rparodi #+# #+# */ +/* Updated: 2024/09/20 20:03:43 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef PHONEBOOK_H +#define PHONEBOOK_H + +#include +#include + +class contact { + public: + int id; + std::string number; + std::string first_name; + std::string last_name; + std::string nickname; + + void print(void); +}; + +#endif