From b345d058f8d27913880fa8354a7a54f9c9adfad5 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Fri, 25 Oct 2024 23:24:09 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E2=9C=A8=E3=80=8D=20feat(Megaphone):?= =?UTF-8?q?=20Finished=20megaphone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ ex00/Makefile | 4 ++-- ex00/megaphone.cpp | 26 +++++++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 2416a67..660774b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ obj/ +ex00/megaphone +megaphone diff --git a/ex00/Makefile b/ex00/Makefile index 61c19fd..d5b7b78 100644 --- a/ex00/Makefile +++ b/ex00/Makefile @@ -6,7 +6,7 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2024/10/25 16:09:27 by adjoly #+# #+# # -# Updated: 2024/10/25 16:40:34 by adjoly ### ########.fr # +# Updated: 2024/10/25 17:48:45 by adjoly ### ########.fr # # # # **************************************************************************** # @@ -25,7 +25,7 @@ FLAGS = -Wall -Werror -Wextra -std=c++98 all: $(NAME) $(NAME): $(OBJS) - @printf "\n \x1B[1;33m[  ]\x1B[0m compiling $(NAME)..." + @printf "\x1B[1;33m[  ]\x1B[0m compiling $(NAME)..." @$(CC) $(FLAGS) $(OBJS) -o $(NAME) @printf "\x1B[2K\r \x1B[1;33m[  ]\x1B[0m $(NAME) compiled.\n" diff --git a/ex00/megaphone.cpp b/ex00/megaphone.cpp index ab50b89..b2c552f 100644 --- a/ex00/megaphone.cpp +++ b/ex00/megaphone.cpp @@ -6,15 +6,39 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/25 16:31:50 by adjoly #+# #+# */ -/* Updated: 2024/10/25 16:54:55 by adjoly ### ########.fr */ +/* Updated: 2024/10/25 17:47:40 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ +#include #include +#include + +void str_to_upper(std::string &str) +{ + char *ptr = (char *)str.c_str(); + while (*ptr) + { + *ptr = std::toupper(*ptr); + ptr++; + } +} + int main(int ac, char **av) { + std::string str; + (void)av; if (ac < 2) std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *" << std::endl; + else + { + while (++av && *av) + str.append(*av); + str_to_upper(str); + std::cout << str << std::endl; + + } + return (0); }