diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-24 18:57:19 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-24 18:57:19 +0200 |
| commit | 475449dd4b1f3308bac6f72c34d87812216a0738 (patch) | |
| tree | 319a76f0e87b041818156f2d1dfbbc6a7dfacf06 /exam02/subjects | |
| parent | 83edb77d74bb339f3e1324a51039c78ac503db90 (diff) | |
| download | piscine-475449dd4b1f3308bac6f72c34d87812216a0738.tar.gz piscine-475449dd4b1f3308bac6f72c34d87812216a0738.tar.bz2 piscine-475449dd4b1f3308bac6f72c34d87812216a0738.zip | |
exam02
Diffstat (limited to 'exam02/subjects')
| -rw-r--r-- | exam02/subjects/0-0-aff_a/subject.en.txt | 20 | ||||
| -rw-r--r-- | exam02/subjects/0-0-aff_a/subject.fr.txt | 22 | ||||
| -rw-r--r-- | exam02/subjects/1-0-ft_swap/\ | 12 | ||||
| -rw-r--r-- | exam02/subjects/1-0-ft_swap/subject.en.txt | 11 | ||||
| -rw-r--r-- | exam02/subjects/1-0-ft_swap/subject.fr.txt | 11 | ||||
| -rw-r--r-- | exam02/subjects/2-0-ft_strrev/subject.en.txt | 12 | ||||
| -rw-r--r-- | exam02/subjects/2-0-ft_strrev/subject.fr.txt | 12 | ||||
| -rw-r--r-- | exam02/subjects/3-0-inter/examples.txt | 9 | ||||
| -rw-r--r-- | exam02/subjects/3-0-inter/subject.en.txt | 23 | ||||
| -rw-r--r-- | exam02/subjects/3-0-inter/subject.fr.txt | 23 | ||||
| -rw-r--r-- | exam02/subjects/4-0-ft_atoi/subject.en.txt | 13 | ||||
| -rw-r--r-- | exam02/subjects/4-0-ft_atoi/subject.fr.txt | 12 | ||||
| -rw-r--r-- | exam02/subjects/5-0-ft_rrange/subject.en.txt | 19 | ||||
| -rw-r--r-- | exam02/subjects/5-0-ft_rrange/subject.fr.txt | 19 | ||||
| -rw-r--r-- | exam02/subjects/6-0-ft_list_remove_if/subject.en.txt | 23 | ||||
| -rw-r--r-- | exam02/subjects/6-0-ft_list_remove_if/subject.fr.txt | 23 |
16 files changed, 264 insertions, 0 deletions
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; +$> |
