From b34fd5e7e2c4a2c81c711fa1127efdfcd69d0e1b Mon Sep 17 00:00:00 2001 From: Aleksei Chubukov Date: Thu, 23 Nov 2023 01:34:57 +0400 Subject: [PATCH] small changes to mains --- Makefile | 9 +++++---- c00/ex00.c | 12 +++++++++--- c00/ex01.c | 5 ++++- c00/ex02.c | 14 +++----------- c00/ex03.c | 14 +++----------- c01/ex08.c | 2 +- c02/ex00.c | 9 +++++++++ 7 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 c02/ex00.c diff --git a/Makefile b/Makefile index cf9e408..0a757af 100644 --- a/Makefile +++ b/Makefile @@ -7,18 +7,19 @@ empty:= space:= $(empty) $(empty) CFLAGS_MANDATORY := -Wall -Wextra -Werror all_builds := $(foreach e, 00 01 02 03 04 05 06 07 08, build/c00/ex$e) \ - $(foreach e, 00 01 02 03 04 05 06 07 08, build/c01/ex$e) + $(foreach e, 00 01 02 03 04 05 06 07 08, build/c01/ex$e) \ + $(foreach e, 00 01 02 03 04 05 06 07 08 09 10 11 12, build/c02/ex$e) \ + all: norme $(all_builds) build: mkdir $@ clean: rm -rf build +.PHONY: all norme clean .SECONDEXPANSION: -build/c%: $(OFFSHORE_PROJECTS)/c$$(subst _,+,$$*)/*.c $$(OFFSHORE_MAINS)/c$$*.c +build/c%: $(OFFSHORE_PROJECTS)/c$$*/*.c $$(OFFSHORE_MAINS)/c$$*.c mkdir -p $(@D) $(CC) -o $@ $(CFLAGS_MANDATORY) $(CFLAGS) $^ norme: $$(wildcard $(OFFSHORE_PROJECTS)/c*) norminette -R CheckForbiddenSourceHeader $^ - -.PHONY: all norme clean diff --git a/c00/ex00.c b/c00/ex00.c index a7c637d..f30b674 100644 --- a/c00/ex00.c +++ b/c00/ex00.c @@ -6,13 +6,19 @@ /* By: achubuko +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/18 19:43:15 by achubuko #+# #+# */ -/* Updated: 2023/11/18 19:52:46 by achubuko ### ########.fr */ +/* Updated: 2023/11/23 01:00:45 by achubuko ### ########.fr */ /* */ /* ************************************************************************** */ - +#include void ft_putchar(char c); int main() { - ft_putchar('0'); + printf("Hello\n"); + ft_putchar('H'); + ft_putchar('e'); + ft_putchar('l'); + ft_putchar('l'); + ft_putchar('o'); + ft_putchar('\n'); } diff --git a/c00/ex01.c b/c00/ex01.c index 2bfe84b..82088cf 100644 --- a/c00/ex01.c +++ b/c00/ex01.c @@ -6,13 +6,16 @@ /* By: achubuko +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */ -/* Updated: 2023/11/18 20:46:04 by achubuko ### ########.fr */ +/* Updated: 2023/11/23 01:08:00 by achubuko ### ########.fr */ /* */ /* ************************************************************************** */ +#include void ft_print_alphabet(void); int main(void) { + write(1, "abcdefghijklmnopqrstuvwxyz%\n", 28); ft_print_alphabet(); + write(1,"%\n", 2); return 0; } diff --git a/c00/ex02.c b/c00/ex02.c index 738b46c..58cad25 100644 --- a/c00/ex02.c +++ b/c00/ex02.c @@ -1,18 +1,10 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* c00_ex01.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: achubuko +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */ -/* Updated: 2023/11/18 22:07:50 by achubuko ### ########.fr */ -/* */ -/* ************************************************************************** */ +#include void ft_print_reverse_alphabet(void); int main(void) { + write(1, "zyxwvutsrqponmlkjihgfedcba%\n", 28); ft_print_reverse_alphabet(); + write(1, "%\n", 2); return 0; } diff --git a/c00/ex03.c b/c00/ex03.c index f57e2ca..b704bcf 100644 --- a/c00/ex03.c +++ b/c00/ex03.c @@ -1,18 +1,10 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* c00_ex01.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: achubuko +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/11/18 20:31:16 by achubuko #+# #+# */ -/* Updated: 2023/11/18 22:24:47 by achubuko ### ########.fr */ -/* */ -/* ************************************************************************** */ +#include void ft_print_numbers(void); int main(void) { + write(1, "0123456789%\n", 12); ft_print_numbers(); + write(1, "%\n", 2); return 0; } diff --git a/c01/ex08.c b/c01/ex08.c index 7215f08..058666c 100644 --- a/c01/ex08.c +++ b/c01/ex08.c @@ -15,7 +15,7 @@ void ft_sort_int_tab(int *tab, int size); int main(void) { int l = 21; - int a[21] = {4864, 3701, 20180, 26376, 32663, 15756, 18510, 1899, 9799, 13343, 25186, 7746, 8528, 7746, 11579, 4635, 25883, 23006, 3988, 21611, 26591}; + int a[21] = {4864, 3701, 20180, -26376, 32663, 15756, -18510, -1899, 9799, 13343, -25186, 7746, 8528, 7746, 11579, 4635, 25883, 23006, 3988, 21611, 26591}; printarr(a, l); ft_sort_int_tab(a, l); printarr(a, l); diff --git a/c02/ex00.c b/c02/ex00.c new file mode 100644 index 0000000..248dee6 --- /dev/null +++ b/c02/ex00.c @@ -0,0 +1,9 @@ +char *ft_strcpy(char *dest, char *src); +int main(void) +{ + char s[100] = "hello"; + char d[100] = "goodbye"; + + ft_strcpy(s, d); + +}