diff options
| author | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-24 18:57:19 +0200 |
|---|---|---|
| committer | Cabergs Charles <cacharle@e-r6-p7.s19.be> | 2019-07-24 18:57:19 +0200 |
| commit | ad9867052d496f2c2a7f120a512208fb4dd4e787 (patch) | |
| tree | 319a76f0e87b041818156f2d1dfbbc6a7dfacf06 | |
| parent | 79e6c8152252bac1cd632e224ac496a1823da1a5 (diff) | |
| download | piscine-ad9867052d496f2c2a7f120a512208fb4dd4e787.tar.gz piscine-ad9867052d496f2c2a7f120a512208fb4dd4e787.tar.bz2 piscine-ad9867052d496f2c2a7f120a512208fb4dd4e787.zip | |
exam02
24 files changed, 662 insertions, 0 deletions
diff --git a/exam02/rendu/__GIT_HISTORY b/exam02/rendu/__GIT_HISTORY new file mode 100755 index 0000000..d5f359c --- /dev/null +++ b/exam02/rendu/__GIT_HISTORY @@ -0,0 +1,116 @@ +commit 3504df713290070aacf0a8da8001336fb62b4577 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 20:46:13 2019 +0200 + + asdfasdf + + ft_list_remove_if/ft_list_remove_if.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit 9d00fa46ce651f5943087bad69a911bfebdc88ad +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 20:39:22 2019 +0200 + + asf + + ft_list_remove_if/ft_list_remove_if.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +commit 6d9d9ca53f11377f3e2756fd61aa358be5aabdd2 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 20:38:29 2019 +0200 + + asf + + ft_list_remove_if/ft_list_remove_if.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +commit 2f6ad7d91e28d3179d8fd777fe88579d732f15fb +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 20:37:13 2019 +0200 + + list + + ft_list_remove_if/ft_list_remove_if.c | 37 +++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +commit e1d809b40ef3936085f2a56d9e54848b7e77bd8a +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 20:00:12 2019 +0200 + + asdfasdf + + ft_rrange/ft_rrange.c | 27 ++++++++++----------------- + 1 file changed, 10 insertions(+), 17 deletions(-) + +commit 71bf2a5c30017e01d039a3f114b5cc01f4ad334a +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 19:09:56 2019 +0200 + + bonjour + + ft_rrange/ft_rrange.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +commit 40feb08e3202c7d6c83e09b7526258ff82a0a293 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 18:54:17 2019 +0200 + + ft_rrange size + + ft_rrange/ft_rrange.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +commit 9b8fdc6dcf64a8aaf46bbd39f3598616f32e4fc5 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 18:20:30 2019 +0200 + + ft_rrange + + ft_rrange/ft_rrange.c | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +commit e55263c319f4491638e764f7418655a92facec58 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 18:04:12 2019 +0200 + + ft_atoi + + ft_atoi/ft_atoi.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 59 insertions(+) + +commit 6fbc33f57a19fb0b0f101ad538a2011007429568 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 17:45:06 2019 +0200 + + inter + + inter/inter.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 64 insertions(+) + +commit 766b1b4abec091287378709d8f7e20fd27f020b4 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 17:19:23 2019 +0200 + + ft_strrev + + ft_strrev/ft_strrev.c | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +commit 06ff02b093ea8da767601aca500c4d7a7ed4db63 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 17:07:19 2019 +0200 + + ft_swap + + ft_swap/ft_swap.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +commit 4b856e7c41ed7373d74bbe1fe349f235c5e54e79 +Author: Exam 42 <exam-no-reply@42.fr> +Date: Fri Jul 19 17:04:35 2019 +0200 + + aff_a + + aff_a/aff_a.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) diff --git a/exam02/rendu/aff_a/aff_a.c b/exam02/rendu/aff_a/aff_a.c new file mode 100755 index 0000000..ab4867c --- /dev/null +++ b/exam02/rendu/aff_a/aff_a.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* aff_a.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 17:01:33 by exam #+# #+# */ +/* Updated: 2019/07/19 17:03:04 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +int main(int argc, char **argv) +{ + (void)argc; + (void)argv; + write(1, "a\n", 2); + return (0); +} diff --git a/exam02/rendu/ft_atoi/ft_atoi.c b/exam02/rendu/ft_atoi/ft_atoi.c new file mode 100755 index 0000000..eda0f8d --- /dev/null +++ b/exam02/rendu/ft_atoi/ft_atoi.c @@ -0,0 +1,59 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_atoi.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 17:46:19 by exam #+# #+# */ +/* Updated: 2019/07/19 18:03:23 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int pow10(int exponent) +{ + int acc; + + acc = 1; + while (exponent > 0) + { + acc *= 10; + exponent--; + } + return (acc); +} + + +int ft_atoi(const char *str) +{ + int nb; + int i; + int j; + int is_negative; + + nb = 0; + while (*str == ' ' | *str == '\t' || *str == '\n' || *str == '\v' + || *str == '\f' || *str == '\r') + str++; + is_negative = 0; + if (*str == '-' || *str == '+') + { + if (*str == '-') + is_negative = 1; + str++; + } + j = 0; + while (str[j] >= '0' && str[j] <= '9') + j++; + j--; + i = 0; + while (j >= 0) + { + nb += (str[j] - '0') * pow10(i); + i++; + j--; + } + if (is_negative) + nb = -nb; + return (nb); +} diff --git a/exam02/rendu/ft_list_remove_if/ft_list_remove_if.c b/exam02/rendu/ft_list_remove_if/ft_list_remove_if.c new file mode 100755 index 0000000..57d627c --- /dev/null +++ b/exam02/rendu/ft_list_remove_if/ft_list_remove_if.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_list_remove_if.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 20:02:01 by exam #+# #+# */ +/* Updated: 2019/07/19 20:46:03 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "ft_list.h" + +void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()) +{ + t_list *cursor; + t_list *prev; + + if (!*begin_list) + return ; + while (*begin_list && (*cmp)(data_ref, (*begin_list)->data)) + *begin_list = (*begin_list)->next; + cursor = *begin_list; + prev = NULL; + while (cursor) + { + while (cursor && (*cmp)(data_ref, cursor->data)) + { + if (prev != NULL) + prev->next = cursor->next; + cursor = cursor->next; + } + prev = cursor; + if (cursor) + cursor = cursor->next; + } +} diff --git a/exam02/rendu/ft_rrange/ft_rrange.c b/exam02/rendu/ft_rrange/ft_rrange.c new file mode 100755 index 0000000..d97081a --- /dev/null +++ b/exam02/rendu/ft_rrange/ft_rrange.c @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_rrange.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 18:05:29 by exam #+# #+# */ +/* Updated: 2019/07/19 19:59:56 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <stdlib.h> + +long unsigned int get_size(int start, int end) +{ + long unsigned int size; + + if (start < end) + size = (long int)end - (long int)start; + else if (start > end) + size = (long int)start - (long int)end; + else + size = 0; + return (size); +} + +int *ft_rrange(int start, int end) +{ + int *rrange; + long unsigned int i; + + if ((rrange = (int*)malloc(sizeof(int) * (get_size(start, end) + 1))) == NULL) + return (NULL); + rrange[0] = end; + if (start == end) + return (rrange); + i = 0; + while (end != start) + { + rrange[i] = end; + end += (end < start ? 1 : -1); + i++; + } + rrange[i] = start; + return (rrange); +} diff --git a/exam02/rendu/ft_strrev/ft_strrev.c b/exam02/rendu/ft_strrev/ft_strrev.c new file mode 100755 index 0000000..c58bc25 --- /dev/null +++ b/exam02/rendu/ft_strrev/ft_strrev.c @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strrev.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 17:08:38 by exam #+# #+# */ +/* Updated: 2019/07/19 17:18:13 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +char *ft_strrev(char *str) +{ + int i; + int j; + char tmp; + + i = 0; + j = 0; + while (str[j]) + j++; + j--; + while (i < j) + { + tmp = str[i]; + str[i] = str[j]; + str[j] = tmp; + j--; + i++; + } + return (str); +} diff --git a/exam02/rendu/ft_swap/ft_swap.c b/exam02/rendu/ft_swap/ft_swap.c new file mode 100755 index 0000000..acf1212 --- /dev/null +++ b/exam02/rendu/ft_swap/ft_swap.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_swap.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 17:05:36 by exam #+# #+# */ +/* Updated: 2019/07/19 17:06:14 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +void ft_swap(int *a, int *b) +{ + int tmp; + + tmp = *a; + *a = *b; + *b = tmp; +} diff --git a/exam02/rendu/inter/inter.c b/exam02/rendu/inter/inter.c new file mode 100755 index 0000000..5dc911c --- /dev/null +++ b/exam02/rendu/inter/inter.c @@ -0,0 +1,64 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* inter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: exam <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/19 17:20:35 by exam #+# #+# */ +/* Updated: 2019/07/19 17:44:03 by exam ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> + +int already_checked(char *str, int index) +{ + char tested; + + tested = str[index]; + while (index-- > 0) + if (str[index] == tested) + return (1); + return (0); +} + +int inside(char *str, char c) +{ + while (*str) + { + if (c == *str) + return (1); + str++; + } + return (0); +} + +int main(int argc, char **argv) +{ + char *str1; + char *str2; + int i; + + if (argc != 3) + { + write(1, "\n", 1); + return (0); + } + i = 0; + str1 = argv[1]; + str2 = argv[2]; + while (str1[i]) + { + if (already_checked(str1, i)) + { + i++; + continue ; + } + if (inside(str2, str1[i])) + write(1, &str1[i], 1); + i++; + } + write(1, "\n", 1); + return (0); +} diff --git a/exam02/subjects/0-0-aff_a/subject.en.txt b/exam02/subjects/0-0-aff_a/subject.en.txt new file mode 100644 index 0000000..c8863b4 --- /dev/null +++ b/exam02/subjects/0-0-aff_a/subject.en.txt @@ -0,0 +1,20 @@ +Assignment name : aff_a +Expected files : aff_a.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes a string, and displays the first 'a' character it +encounters in it, followed by a newline. If there are no 'a' characters in the +string, the program diplays 'a' followed by a newline. If the number of parameters is not +1, the program displays 'a' followed by a newline. + +Example: + +$> ./aff_a "abc" | cat -e +a$ +$> ./aff_a "RaInB0w d4Sh!" | cat -e +a$ +$> ./aff_a "ThE Ck3 Is L|3" | cat -e +a$ +$> ./aff_a | cat -e +a$ diff --git a/exam02/subjects/0-0-aff_a/subject.fr.txt b/exam02/subjects/0-0-aff_a/subject.fr.txt new file mode 100644 index 0000000..3dadbad --- /dev/null +++ b/exam02/subjects/0-0-aff_a/subject.fr.txt @@ -0,0 +1,22 @@ +Assignment name : aff_a +Expected files : aff_a.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme qui prend en paramètre une chaîne de caractères, et qui +affiche sur la sortie standard le premier caractère 'a' rencontré dans +cette chaîne, suivi de '\n'. Si aucun 'a' +n'est rencontré dans la chaîne, le programme affiche 'a' suivi de +'\n'. Si le nombre de paramètres est différent de 1, le +programme affiche 'a' suivi de '\n'. + +Exemple: + +$> ./aff_a "abc" | cat -e +a$ +$> ./aff_a "dubO a POIL" | cat -e +a$ +$> ./aff_a "zaz sent le poney" | cat -e +a$ +$> ./aff_a | cat -e +a$ diff --git a/exam02/subjects/1-0-ft_swap/\ b/exam02/subjects/1-0-ft_swap/\ new file mode 100644 index 0000000..8fea86e --- /dev/null +++ b/exam02/subjects/1-0-ft_swap/\ @@ -0,0 +1,12 @@ +Exercitiu : ft_swap +Fisiere de iesire : ft_swap.c +Functii autorizate : +-------------------------------------------------------------------------------- + +Scrieti o functie ce schimba valoarea a doi intregi ale caror adrese sunt +transmise ca parametri. + +Ea trebuie sa aibaprototipul urmator: + +void ft_swap(int *a, int *b); + diff --git a/exam02/subjects/1-0-ft_swap/subject.en.txt b/exam02/subjects/1-0-ft_swap/subject.en.txt new file mode 100644 index 0000000..d8fdd7e --- /dev/null +++ b/exam02/subjects/1-0-ft_swap/subject.en.txt @@ -0,0 +1,11 @@ +Assignment name : ft_swap +Expected files : ft_swap.c +Allowed functions: +-------------------------------------------------------------------------------- + +Write a function that swaps the contents of two integers the adresses of which +are passed as parameters. + +Your function must be declared as follows: + +void ft_swap(int *a, int *b); diff --git a/exam02/subjects/1-0-ft_swap/subject.fr.txt b/exam02/subjects/1-0-ft_swap/subject.fr.txt new file mode 100644 index 0000000..e492fbf --- /dev/null +++ b/exam02/subjects/1-0-ft_swap/subject.fr.txt @@ -0,0 +1,11 @@ +Assignment name : ft_swap +Expected files : ft_swap.c +Allowed functions: +-------------------------------------------------------------------------------- + +Écrire une fonction qui échange le contenu de deux entiers dont les adresses +sont passées en paramêtres. + +Elle devra être prototypée de la façon suivante : + +void ft_swap(int *a, int *b); diff --git a/exam02/subjects/2-0-ft_strrev/subject.en.txt b/exam02/subjects/2-0-ft_strrev/subject.en.txt new file mode 100644 index 0000000..6c31580 --- /dev/null +++ b/exam02/subjects/2-0-ft_strrev/subject.en.txt @@ -0,0 +1,12 @@ +Assignment name : ft_strrev +Expected files : ft_strrev.c +Allowed functions: +-------------------------------------------------------------------------------- + +Write a function that reverses a string by modifying it. + +It must return its parameter. + +Your function must be declared as follows: + +char *ft_strrev(char *str); diff --git a/exam02/subjects/2-0-ft_strrev/subject.fr.txt b/exam02/subjects/2-0-ft_strrev/subject.fr.txt new file mode 100644 index 0000000..f6eb115 --- /dev/null +++ b/exam02/subjects/2-0-ft_strrev/subject.fr.txt @@ -0,0 +1,12 @@ +Assignment name : ft_strrev +Expected files : ft_strrev.c +Allowed functions: +-------------------------------------------------------------------------------- + +Écrire une fonction qui inverse une chaîne de caractères en la modifiant. + +Elle devra renvoyer son paramètre. + +Votre fonction devra être prototypée de la façon suivante : + +char *ft_strrev(char *str); diff --git a/exam02/subjects/3-0-inter/examples.txt b/exam02/subjects/3-0-inter/examples.txt new file mode 100644 index 0000000..57c63e8 --- /dev/null +++ b/exam02/subjects/3-0-inter/examples.txt @@ -0,0 +1,9 @@ +$>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e +padinto$ +$>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e +df6ewg4$ +$>./inter "rien" "cette phrase ne cache rien" | cat -e +rien$ +$>./inter | cat -e +$ + diff --git a/exam02/subjects/3-0-inter/subject.en.txt b/exam02/subjects/3-0-inter/subject.en.txt new file mode 100644 index 0000000..7259b8b --- /dev/null +++ b/exam02/subjects/3-0-inter/subject.en.txt @@ -0,0 +1,23 @@ +Assignment name : inter +Expected files : inter.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes two strings and displays, without doubles, the +characters that appear in both strings, in the order they appear in the first +one. + +The display will be followed by a \n. + +If the number of arguments is not 2, the program displays \n. + +Examples: + +$>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e +padinto$ +$>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e +df6ewg4$ +$>./inter "nothing" "This sentence hides nothing" | cat -e +nothig$ +$>./inter | cat -e +$ diff --git a/exam02/subjects/3-0-inter/subject.fr.txt b/exam02/subjects/3-0-inter/subject.fr.txt new file mode 100644 index 0000000..69cfee8 --- /dev/null +++ b/exam02/subjects/3-0-inter/subject.fr.txt @@ -0,0 +1,23 @@ +Assignment name : inter +Expected files : inter.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme qui prend en paramètres deux chaînes de caractères et qui +affiche sans doublon les caractères communs aux deux chaînes. + +L'affichage se fera dans l'ordre d'apparition dans la premiere chaîne. +L'affichage doit être suivi d'un '\n'. + +Si le nombre de paramètres transmis est différent de 2, le programme affiche +'\n'. + +Exemples: +$>./inter "padinton" "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e +padinto$ +$>./inter ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e +df6ewg4$ +$>./inter "rien" "cette phrase ne cache rien" | cat -e +rien$ +$>./inter | cat -e +$ diff --git a/exam02/subjects/4-0-ft_atoi/subject.en.txt b/exam02/subjects/4-0-ft_atoi/subject.en.txt new file mode 100644 index 0000000..ebfe92b --- /dev/null +++ b/exam02/subjects/4-0-ft_atoi/subject.en.txt @@ -0,0 +1,13 @@ +Assignment name : ft_atoi +Expected files : ft_atoi.c +Allowed functions: None +-------------------------------------------------------------------------------- + +Write a function that converts the string argument str to an integer (type int) +and returns it. + +It works much like the standard atoi(const char *str) function, see the man. + +Your function must be declared as follows: + +int ft_atoi(const char *str); diff --git a/exam02/subjects/4-0-ft_atoi/subject.fr.txt b/exam02/subjects/4-0-ft_atoi/subject.fr.txt new file mode 100644 index 0000000..2c9977c --- /dev/null +++ b/exam02/subjects/4-0-ft_atoi/subject.fr.txt @@ -0,0 +1,12 @@ +Assignment name : ft_atoi +Expected files : ft_atoi.c +Allowed functions: None +-------------------------------------------------------------------------------- + +Écrire une fonction qui convertit une chaîne en un entier (type int) et le retourne. + +Marche comme la fonction standard atoi(const char *str), voir le man. + +La fonction doit être prototypée comme suit: + +int ft_atoi(const char *str); diff --git a/exam02/subjects/5-0-ft_rrange/subject.en.txt b/exam02/subjects/5-0-ft_rrange/subject.en.txt new file mode 100644 index 0000000..f9129bc --- /dev/null +++ b/exam02/subjects/5-0-ft_rrange/subject.en.txt @@ -0,0 +1,19 @@ +Assignment name : ft_rrange +Expected files : ft_rrange.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Write the following function: + +int *ft_rrange(int start, int end); + +It must allocate (with malloc()) an array of integers, fill it with consecutive +values that begin at end and end at start (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 3, 2 and 1 +- With (-1, 2) you will return an array containing 2, 1, 0 and -1. +- With (0, 0) you will return an array containing 0. +- With (0, -3) you will return an array containing -3, -2, -1 and 0. diff --git a/exam02/subjects/5-0-ft_rrange/subject.fr.txt b/exam02/subjects/5-0-ft_rrange/subject.fr.txt new file mode 100644 index 0000000..1a1e44c --- /dev/null +++ b/exam02/subjects/5-0-ft_rrange/subject.fr.txt @@ -0,0 +1,19 @@ +Assignment name : ft_rrange +Expected files : ft_rrange.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Écrire la fonction suivante : + +int *ft_rrange(int start, int end); + +Cette fonction doit allouer avec malloc() un tableau d'ints, le remplir avec +les valeurs (consécutives) démarrant à end et finissant à start (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 3, 2 et 1. +- Avec (-1, 2) vous devrez renvoyer un tableau contenant 2, 1, 0 et -1. +- Avec (0, 0) vous devrez renvoyer un tableau contenant 0. +- Avec (0, -3) vous devrez renvoyer un tableau contenant -3, -2, -1 et 0. diff --git a/exam02/subjects/6-0-ft_list_remove_if/subject.en.txt b/exam02/subjects/6-0-ft_list_remove_if/subject.en.txt new file mode 100644 index 0000000..f9b9783 --- /dev/null +++ b/exam02/subjects/6-0-ft_list_remove_if/subject.en.txt @@ -0,0 +1,23 @@ +Assignment name : ft_list_remove_if +Expected files : ft_list_remove_if.c +Allowed functions: free +-------------------------------------------------------------------------------- + +Write a function called ft_list_remove_if that removes from the +passed list any element the data of which is "equal" to the reference data. + +It will be declared as follows : + +void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()); + +cmp takes two void* and returns 0 when both parameters are equal. + +You have to use the ft_list.h file, which will contain: + +$>cat ft_list.h +typedef struct s_list +{ + struct s_list *next; + void *data; +} t_list; +$> diff --git a/exam02/subjects/6-0-ft_list_remove_if/subject.fr.txt b/exam02/subjects/6-0-ft_list_remove_if/subject.fr.txt new file mode 100644 index 0000000..cba53ae --- /dev/null +++ b/exam02/subjects/6-0-ft_list_remove_if/subject.fr.txt @@ -0,0 +1,23 @@ +Assignment name : ft_list_remove_if +Expected files : ft_list_remove_if.c +Allowed functions: free +-------------------------------------------------------------------------------- + +Écrire une fonction ft_list_remove_if qui efface de la liste tous les élements +dont la donnée est "égale" à la donnée de référence. + +Elle devra être prototypée de la façon suivante : + +void ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)()); + +cmp prends deux void* et renvoie 0 lorsque les 2 paramètres sont égaux. + +À la correction, vous disposez du fichier ft_list.h tel que : + +$>cat ft_list.h +typedef struct s_list +{ + struct s_list *next; + void *data; +} t_list; +$> |
