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/subjects | |
| 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/subjects')
20 files changed, 374 insertions, 0 deletions
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. diff --git a/exam01/subjects/4-1-ft_range/subject.en.txt b/exam01/subjects/4-1-ft_range/subject.en.txt new file mode 100644 index 0000000..66a77a2 --- /dev/null +++ b/exam01/subjects/4-1-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-1-ft_range/subject.fr.txt b/exam01/subjects/4-1-ft_range/subject.fr.txt new file mode 100644 index 0000000..9e848b3 --- /dev/null +++ b/exam01/subjects/4-1-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. diff --git a/exam01/subjects/5-0-ft_split/subject.en.txt b/exam01/subjects/5-0-ft_split/subject.en.txt new file mode 100644 index 0000000..97375e9 --- /dev/null +++ b/exam01/subjects/5-0-ft_split/subject.en.txt @@ -0,0 +1,14 @@ +Assignment name : ft_split +Expected files : ft_split.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Write a function that takes a string, splits it into words, and returns them as +a NULL-terminated array of strings. + +A "word" is defined as a part of a string delimited either by spaces/tabs/new +lines, or by the start/end of the string. + +Your function must be declared as follows: + +char **ft_split(char *str); diff --git a/exam01/subjects/5-0-ft_split/subject.fr.txt b/exam01/subjects/5-0-ft_split/subject.fr.txt new file mode 100644 index 0000000..acd1b41 --- /dev/null +++ b/exam01/subjects/5-0-ft_split/subject.fr.txt @@ -0,0 +1,16 @@ +Assignment name : ft_split +Expected files : ft_split.c +Allowed functions: malloc +-------------------------------------------------------------------------------- + +Écrire une fonction qui prend en paramètre une chaîne de caractères et la +découpe en mots, qui seront retournés sous la forme d'un tableau de chaînes +terminé par NULL. + +On appelle "mot" une portion de chaîne de caractères délimitée soit par des +espaces, des retours à la ligne et/ou des tabulations, soit par le début / fin +de la chaîne. + +Votre fonction devra être prototypée de la façon suivante : + +char **ft_split(char *str); |
