diff options
| author | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-16 12:58:13 +0200 |
|---|---|---|
| committer | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-16 12:58:13 +0200 |
| commit | 66635d69fa00e335a091d7e6f2b358cbaaf205e4 (patch) | |
| tree | 3ecf5a41b4541980ba0287a431681cd5ae25ad84 /exam01 | |
| parent | 11114fd684250943de56c4f73ab45c97f2aaf83a (diff) | |
| download | piscine-66635d69fa00e335a091d7e6f2b358cbaaf205e4.tar.gz piscine-66635d69fa00e335a091d7e6f2b358cbaaf205e4.tar.bz2 piscine-66635d69fa00e335a091d7e6f2b358cbaaf205e4.zip | |
c09 passed, c10 start, exam00 and exam01
Diffstat (limited to 'exam01')
35 files changed, 1676 insertions, 0 deletions
diff --git a/exam01/rendu/__GIT_HISTORY b/exam01/rendu/__GIT_HISTORY new file mode 100755 index 0000000..07c2777 --- /dev/null +++ b/exam01/rendu/__GIT_HISTORY @@ -0,0 +1,71 @@ +commit 45e8e511bd3d91e4cc7d44cef1257914d442541c +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 19:28:29 2019 +0200 + + ft_split + + ft_split/ft_split.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 72 insertions(+) + +commit 3f66b01dadeabbfb7332ca8eaff6c651baa7d60c +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 18:33:39 2019 +0200 + + overme + + ft_range/ft_range.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +commit 2fa3ca5efbeea644b056cbaa24c006cb475f1d68 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 18:22:27 2019 +0200 + + ft_range + + ft_range/ft_range.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +commit b9247efc1f78a0f27a5e8cb097a6d09316541982 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 17:58:16 2019 +0200 + + k you dumb fuck + + wdmatch/wdmatch.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +commit 79c5bf10efda0eead115b274dac91ad92587a53d +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 17:55:47 2019 +0200 + + wdmatch + + wdmatch/wdmatch.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 55 insertions(+) + +commit 39cdf357b40ced49f3ac6290d932c7801816115d +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 17:22:53 2019 +0200 + + rotone + + rotone/rotone.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +commit c265e4850d0962b936392aca4f3fd6668bd213b2 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 17:11:27 2019 +0200 + + rev_print + + rev_print/rev_print.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +commit 9addd4166252d59255a58e3c6c1c7a1e926b37d3 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 12 17:04:19 2019 +0200 + + hello + + hello/hello.c | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) diff --git a/exam01/rendu/ft_range/ft_range.c b/exam01/rendu/ft_range/ft_range.c new file mode 100755 index 0000000..de8c414 --- /dev/null +++ b/exam01/rendu/ft_range/ft_range.c @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_range.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 18:00:18 by exam #+# #+# */ +/* Updated: 2019/07/12 18:32:44 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <stdlib.h> + +int *ft_range(int start, int end) +{ + int *range; + int i; + + range = (int*)malloc(sizeof(int) * + (end - start < 0 ? start - end : end - start + 1)); + if (range == NULL) + return (NULL); + i = 0; + if (start < end) + while (start <= end) + { + range[i] = start; + start++; + i++; + } + else + while (start >= end) + { + range[i] = start; + start--; + i++; + } + return (range); +} diff --git a/exam01/rendu/ft_split/ft_split.c b/exam01/rendu/ft_split/ft_split.c new file mode 100755 index 0000000..7c8e5c7 --- /dev/null +++ b/exam01/rendu/ft_split/ft_split.c @@ -0,0 +1,72 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_split.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 18:35:38 by exam #+# #+# */ +/* Updated: 2019/07/12 19:27:00 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <stdlib.h> + +#define ISSEP(c) (c == ' ' || c == '\n' || c == '\t') + +int count_segment(char *str) +{ + int counter; + + counter = 0; + while (*str) + { + if (!ISSEP(*str)) + { + counter++; + while (*str && !ISSEP(*str)) + str++; + if (!*str) + break; + } + str++; + } + return (counter); +} + +char **ft_split(char *str) +{ + char **split; + char *tmp; + int i; + int j; + int segments; + + segments = count_segment(str); + split = (char**)malloc(sizeof(char*) * segments + 1); + if (split == NULL) + return (NULL); + j = 0; + while (j < segments) + { + if (ISSEP(*str)) + { + str++; + continue; + } + i = 0; + while (!ISSEP(str[i])) + i++; + tmp = (char*)malloc(sizeof(char) * i + 1); + if (tmp == NULL) + return (NULL); + i = 0; + while (!ISSEP(*str)) + tmp[i++] = *str++; + tmp[i] = '\0'; + split[j] = tmp; + j++; + } + split[j] = NULL; + return (split); +} diff --git a/exam01/rendu/hello/hello.c b/exam01/rendu/hello/hello.c new file mode 100755 index 0000000..0becc7e --- /dev/null +++ b/exam01/rendu/hello/hello.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* hello.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 17:01:31 by exam #+# #+# */ +/* Updated: 2019/07/12 17:03:00 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +int main(void) +{ + write(1, "Hello World!\n", 13); +} diff --git a/exam01/rendu/rev_print/rev_print.c b/exam01/rendu/rev_print/rev_print.c new file mode 100755 index 0000000..b46a2d6 --- /dev/null +++ b/exam01/rendu/rev_print/rev_print.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* rev_print.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 17:06:11 by exam #+# #+# */ +/* Updated: 2019/07/12 17:10:21 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +int main(int argc, char **argv) +{ + int i; + + if (argc == 1 || argc > 2) + { + write(1, "\n", 1); + return (0); + } + + i = 0; + while (argv[1][i]) + i++; + while (i-- > 0) + write(1, &argv[1][i], 1); + write(1, "\n", 1); + return (0); +} diff --git a/exam01/rendu/rotone/rotone.c b/exam01/rendu/rotone/rotone.c new file mode 100755 index 0000000..55a6ef5 --- /dev/null +++ b/exam01/rendu/rotone/rotone.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* rotone.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 17:12:59 by exam #+# #+# */ +/* Updated: 2019/07/12 17:21:12 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +void ft_putchar(char c) +{ + write(1, &c, 1); +} + +int main(int argc, char **argv) +{ + if (argc == 1 || argc > 2) + { + write(1, "\n", 1); + return (0); + } + while (*argv[1]) + { + if (*argv[1] >= 'a' && *argv[1] <= 'z') + ft_putchar(*argv[1] == 'z' ? 'a' : *argv[1] + 1); + else if (*argv[1] >= 'A' && *argv[1] <= 'Z') + ft_putchar(*argv[1] == 'Z' ? 'A' : *argv[1] + 1); + else + ft_putchar(*argv[1]); + argv[1]++; + } + write(1, "\n", 1); + return (0); +} diff --git a/exam01/rendu/wdmatch/wdmatch.c b/exam01/rendu/wdmatch/wdmatch.c new file mode 100755 index 0000000..96242c9 --- /dev/null +++ b/exam01/rendu/wdmatch/wdmatch.c @@ -0,0 +1,54 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* wdmatch.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/12 17:25:25 by exam #+# #+# */ +/* Updated: 2019/07/12 17:57:14 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +int in_charset(char c, char *charset) +{ + while (*charset) + if (c == *charset++) + return (1); + return (0); +} + +int main(int argc, char **argv) +{ + int i; + int j; + char *str; + char *charset; + + if (argc != 3) + { + write(1, "\n", 1); + return (0); + } + str = argv[1]; + charset = argv[2]; + i = 0; + j = 0; + while (str[i]) + { + if (!in_charset(str[i], charset)) + { + write(1, "\n", 1); + return (0); + } + while (*charset != str[i]) + charset++; + i++; + } + while (*str) + write(1, str++, 1); + write(1, "\n", 1); + return (0); +} diff --git a/exam01/subjects/0-0-hello/examples.txt b/exam01/subjects/0-0-hello/examples.txt new file mode 100644 index 0000000..4ac95f1 --- /dev/null +++ b/exam01/subjects/0-0-hello/examples.txt @@ -0,0 +1,5 @@ +$>./hello +Hello World! +$>./hello | cat -e +Hello World!$ +$> diff --git a/exam01/subjects/0-0-hello/subject.en.txt b/exam01/subjects/0-0-hello/subject.en.txt new file mode 100644 index 0000000..9dcbeaf --- /dev/null +++ b/exam01/subjects/0-0-hello/subject.en.txt @@ -0,0 +1,14 @@ +Assignment name : hello +Expected files : hello.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that displays "Hello World!" followed by a \n. + +Example: + +$>./hello +Hello World! +$>./hello | cat -e +Hello World!$ +$> diff --git a/exam01/subjects/0-0-hello/subject.fr.txt b/exam01/subjects/0-0-hello/subject.fr.txt new file mode 100644 index 0000000..9b4e158 --- /dev/null +++ b/exam01/subjects/0-0-hello/subject.fr.txt @@ -0,0 +1,14 @@ +Assignment name : hello +Expected files : hello.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme qui affiche "Hello World!" suivi d'un \n. + +Exemple: + +$>./hello +Hello World! +$>./hello | cat -e +Hello World!$ +$> diff --git a/exam01/subjects/1-0-rev_print/subject.en.txt b/exam01/subjects/1-0-rev_print/subject.en.txt new file mode 100644 index 0000000..7898a0d --- /dev/null +++ b/exam01/subjects/1-0-rev_print/subject.en.txt @@ -0,0 +1,18 @@ +Assignment name : rev_print +Expected files : rev_print.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes a string, and displays the string in reverse +followed by a newline. + +If the number of parameters is not 1, the program displays a newline. + +Examples: + +$> ./rev_print "rainbow dash" | cat -e +hsad wobniar$ +$> ./rev_print "Ponies are awesome" | cat -e +emosewa era seinoP$ +$> ./rev_print | cat -e +$ diff --git a/exam01/subjects/1-0-rev_print/subject.fr.txt b/exam01/subjects/1-0-rev_print/subject.fr.txt new file mode 100644 index 0000000..4af7395 --- /dev/null +++ b/exam01/subjects/1-0-rev_print/subject.fr.txt @@ -0,0 +1,18 @@ +Assignment name : rev_print +Expected files : rev_print.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme qui prend une chaîne et l'affiche en ordre inverse suivie +d'un newline. + +Si le nombre d'arguments n'est pas 1, le programme affiche un newline. + +Exemples: + +$> ./rev_print "zaz" | cat -e +zaz$ +$> ./rev_print "dub0 a POIL" | cat -e +LIOP a 0bud$ +$> ./rev_print | cat -e +$ diff --git a/exam01/subjects/2-0-rotone/examples.txt b/exam01/subjects/2-0-rotone/examples.txt new file mode 100644 index 0000000..b8db87f --- /dev/null +++ b/exam01/subjects/2-0-rotone/examples.txt @@ -0,0 +1,12 @@ +$>./rotone "abc" +bcd +$>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e +Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ +$>./rotone "AkjhZ zLKIJz , 23y " | cat -e +BlkiA aMLJKa , 23z $ +$>./rotone | cat -e +$ +$> +$>./rotone "" | cat -e +$ +$> diff --git a/exam01/subjects/2-0-rotone/subject.en.txt b/exam01/subjects/2-0-rotone/subject.en.txt new file mode 100644 index 0000000..093fc7a --- /dev/null +++ b/exam01/subjects/2-0-rotone/subject.en.txt @@ -0,0 +1,28 @@ +Assignment name : rotone +Expected files : rotone.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes a string and displays it, replacing each of its +letters by the next one in alphabetical order. + +'z' becomes 'a' and 'Z' becomes 'A'. Case remains unaffected. + +The output will be followed by a \n. + +If the number of arguments is not 1, the program displays \n. + +Example: + +$>./rotone "abc" +bcd +$>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e +Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ +$>./rotone "AkjhZ zLKIJz , 23y " | cat -e +BlkiA aMLJKa , 23z $ +$>./rotone | cat -e +$ +$> +$>./rotone "" | cat -e +$ +$> diff --git a/exam01/subjects/2-0-rotone/subject.fr.txt b/exam01/subjects/2-0-rotone/subject.fr.txt new file mode 100644 index 0000000..07e5004 --- /dev/null +++ b/exam01/subjects/2-0-rotone/subject.fr.txt @@ -0,0 +1,31 @@ +Assignment name : rotone +Expected files : rotone.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme nommé rotone, qui prend en paramètre une chaîne de +caractères, et qui affiche cette chaîne en remplaçant chaque caractère +alphabétique par le caractère suivant dans l'ordre alphabétique. + +'z' devient 'a' et 'Z' devient 'A'. Les majuscules restent des majuscules, les +minuscules restent des minuscules. + +L'affichage se termine toujours par un retour à la ligne. + +Si le nombre de paramètres transmis est différent de 1, le programme affiche +'\n'. + +Exemple: + +$>./rotone "abc" +bcd +$>./rotone "Les stagiaires du staff ne sentent pas toujours tres bon." | cat -e +Mft tubhjbjsft ev tubgg of tfoufou qbt upvkpvst usft cpo.$ +$>./rotone "AkjhZ zLKIJz , 23y " | cat -e +BlkiA aMLJKa , 23z $ +$>./rotone | cat -e +$ +$> +$>./rotone "" | cat -e +$ +$> diff --git a/exam01/subjects/3-0-wdmatch/examples.txt b/exam01/subjects/3-0-wdmatch/examples.txt new file mode 100644 index 0000000..cf0c96a --- /dev/null +++ b/exam01/subjects/3-0-wdmatch/examples.txt @@ -0,0 +1,10 @@ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "quarante deux" "qfqfsudf arzgsayns tsregfdgs sjytdekuoixq " | cat -e +quarante deux$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$ diff --git a/exam01/subjects/3-0-wdmatch/subject.en.txt b/exam01/subjects/3-0-wdmatch/subject.en.txt new file mode 100644 index 0000000..a8e058d --- /dev/null +++ b/exam01/subjects/3-0-wdmatch/subject.en.txt @@ -0,0 +1,26 @@ +Assignment name : wdmatch +Expected files : wdmatch.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes two strings and checks whether it's possible to +write the first string with characters from the second string, while respecting +the order in which these characters appear in the second string. + +If it's possible, the program displays the string, followed by a \n, otherwise +it simply displays a \n. + +If the number of arguments is not 2, the program displays a \n. + +Examples: + +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "forty two" "qfqfsoudf arzgrsayns tsryegftdgs sjytwdekuooixq " | cat -e +forty two$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$ diff --git a/exam01/subjects/3-0-wdmatch/subject.fr.txt b/exam01/subjects/3-0-wdmatch/subject.fr.txt new file mode 100644 index 0000000..383fe15 --- /dev/null +++ b/exam01/subjects/3-0-wdmatch/subject.fr.txt @@ -0,0 +1,28 @@ +Assignment name : wdmatch +Expected files : wdmatch.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Le programme prend en paramètres deux chaînes de caractères et vérifie qu'il +est possible d'écrire la première chaîne de caractères a l'aide des caractères +de la deuxiême chaîne, tout en respectant l'ordre des caractères dans la +deuxième chaîne. + +Si cela est possible, le programme affiche la première chaîne de caractères, +suivie de '\n'. Sinon le programme affiche seulement '\n'. + +Si le nombre de paramètres transmis est différent de 2, le programme affiche +'\n'. + +Exemples : + +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "forty two" "qfqfsoudf arzgrsayns tsryegftdgs sjytwdekuooixq " | cat -e +forty two$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$
\ No newline at end of file diff --git a/exam01/subjects/3-1-wdmatch/examples.txt b/exam01/subjects/3-1-wdmatch/examples.txt new file mode 100644 index 0000000..cf0c96a --- /dev/null +++ b/exam01/subjects/3-1-wdmatch/examples.txt @@ -0,0 +1,10 @@ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "quarante deux" "qfqfsudf arzgsayns tsregfdgs sjytdekuoixq " | cat -e +quarante deux$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$ diff --git a/exam01/subjects/3-1-wdmatch/subject.en.txt b/exam01/subjects/3-1-wdmatch/subject.en.txt new file mode 100644 index 0000000..a8e058d --- /dev/null +++ b/exam01/subjects/3-1-wdmatch/subject.en.txt @@ -0,0 +1,26 @@ +Assignment name : wdmatch +Expected files : wdmatch.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes two strings and checks whether it's possible to +write the first string with characters from the second string, while respecting +the order in which these characters appear in the second string. + +If it's possible, the program displays the string, followed by a \n, otherwise +it simply displays a \n. + +If the number of arguments is not 2, the program displays a \n. + +Examples: + +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "forty two" "qfqfsoudf arzgrsayns tsryegftdgs sjytwdekuooixq " | cat -e +forty two$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$ diff --git a/exam01/subjects/3-1-wdmatch/subject.fr.txt b/exam01/subjects/3-1-wdmatch/subject.fr.txt new file mode 100644 index 0000000..383fe15 --- /dev/null +++ b/exam01/subjects/3-1-wdmatch/subject.fr.txt @@ -0,0 +1,28 @@ +Assignment name : wdmatch +Expected files : wdmatch.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Le programme prend en paramètres deux chaînes de caractères et vérifie qu'il +est possible d'écrire la première chaîne de caractères a l'aide des caractères +de la deuxiême chaîne, tout en respectant l'ordre des caractères dans la +deuxième chaîne. + +Si cela est possible, le programme affiche la première chaîne de caractères, +suivie de '\n'. Sinon le programme affiche seulement '\n'. + +Si le nombre de paramètres transmis est différent de 2, le programme affiche +'\n'. + +Exemples : + +$>./wdmatch "faya" "fgvvfdxcacpolhyghbreda" | cat -e +faya$ +$>./wdmatch "faya" "fgvvfdxcacpolhyghbred" | cat -e +$ +$>./wdmatch "forty two" "qfqfsoudf arzgrsayns tsryegftdgs sjytwdekuooixq " | cat -e +forty two$ +$>./wdmatch "error" rrerrrfiiljdfxjyuifrrvcoojh | cat -e +$ +$>./wdmatch | cat -e +$
\ No newline at end of file diff --git a/exam01/subjects/4-0-ft_range/subject.en.txt b/exam01/subjects/4-0-ft_range/subject.en.txt new file mode 100644 index 0000000..66a77a2 --- /dev/null +++ b/exam01/subjects/4-0-ft_range/subject.en.txt @@ -0,0 +1,19 @@ +Assignment name : ft_range +Expected files : ft_range.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Write the following function: + +int *ft_range(int start, int end); + +It must allocate (with malloc()) an array of integers, fill it with consecutive +values that begin at start and end at end (Including start and end !), then +return a pointer to the first value of the array. + +Examples: + +- With (1, 3) you will return an array containing 1, 2 and 3. +- With (-1, 2) you will return an array containing -1, 0, 1 and 2. +- With (0, 0) you will return an array containing 0. +- With (0, -3) you will return an array containing 0, -1, -2 and -3. diff --git a/exam01/subjects/4-0-ft_range/subject.fr.txt b/exam01/subjects/4-0-ft_range/subject.fr.txt new file mode 100644 index 0000000..9e848b3 --- /dev/null +++ b/exam01/subjects/4-0-ft_range/subject.fr.txt @@ -0,0 +1,19 @@ +Assignment name : ft_range +Expected files : ft_range.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Écrire la fonction suivante : + +int *ft_range(int start, int end); + +Cette fonction doit allouer avec malloc() un tableau d'ints, le remplir avec +les valeurs (consécutives) démarrant à start et finissant à end (start et end +inclus !), et renvoyer un pointeur vers la première valeur du tableau. + +Exemples: + +- Avec (1, 3) vous devrez renvoyer un tableau contenant 1, 2 et 3. +- Avec (-1, 2) vous devrez renvoyer un tableau contenant -1, 0, 1 et 2. +- Avec (0, 0) vous devrez renvoyer un tableau contenant 0. +- Avec (0, -3) vous devrez renvoyer un tableau contenant 0, -1, -2 et -3. |
