This commit is contained in:
Angel Ortigosa Perez
2025-09-07 10:02:26 +02:00
commit 95c25afc03
8 changed files with 438 additions and 0 deletions

26
ex00/Makefile Normal file
View File

@@ -0,0 +1,26 @@
NAME=megaphone
SRCS=megaphone.cpp
OBJS=$(SRCS:.cpp=.o)
CC=g++
CFLAGS=-Wall -Wextra -Werror -std=c++98
all: $(NAME)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(NAME)
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re

40
ex00/megaphone.cpp Normal file
View File

@@ -0,0 +1,40 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* megaphone.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/02 21:33:09 by hadi #+# #+# */
/* Updated: 2025/09/06 15:34:45 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include <iostream>
int main(int argc, char **argv)
{
int i;
int j;
i = 1;
j = 0;
if (argc >= 2)
{
while (argv[i])
{
j = 0;
while (argv[i][j] != '\0')
{
std::cout << (char)std::toupper(argv[i][j]);
j++;
}
if (argv[i+1])
std::cout << " ";
i++;
}
} else
std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *";
std::cout << std::endl;
return (0);
}