「✨」 feat(Megaphone): Finished megaphone
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
obj/
|
||||
ex00/megaphone
|
||||
megaphone
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# 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"
|
||||
|
||||
|
@ -6,15 +6,39 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <cctype>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user