diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-26 23:17:36 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-26 23:17:36 +0200 |
| commit | 8ec5431354bdb582455e8c32758098c5a0fdada2 (patch) | |
| tree | 480c68814f822439850029df0e0249a2cafb8177 /exam_final/subjects/5-0-last_word | |
| parent | 475449dd4b1f3308bac6f72c34d87812216a0738 (diff) | |
| download | piscine-8ec5431354bdb582455e8c32758098c5a0fdada2.tar.gz piscine-8ec5431354bdb582455e8c32758098c5a0fdada2.tar.bz2 piscine-8ec5431354bdb582455e8c32758098c5a0fdada2.zip | |
exam final
Diffstat (limited to 'exam_final/subjects/5-0-last_word')
| -rw-r--r-- | exam_final/subjects/5-0-last_word/examples.txt | 11 | ||||
| -rw-r--r-- | exam_final/subjects/5-0-last_word/subject.en.txt | 25 | ||||
| -rw-r--r-- | exam_final/subjects/5-0-last_word/subject.fr.txt | 27 |
3 files changed, 63 insertions, 0 deletions
diff --git a/exam_final/subjects/5-0-last_word/examples.txt b/exam_final/subjects/5-0-last_word/examples.txt new file mode 100644 index 0000000..63250f2 --- /dev/null +++ b/exam_final/subjects/5-0-last_word/examples.txt @@ -0,0 +1,11 @@ +$> ./last_word "FOR PONY" | cat -e +PONY$ +$> ./last_word "this ... is sparta, then again, maybe not" | cat -e +not$ +$> ./last_word " " | cat -e +$ +$> ./last_word "a" "b" | cat -e +$ +$> ./last_word " lorem,ipsum " | cat -e +lorem,ipsum$ +$> diff --git a/exam_final/subjects/5-0-last_word/subject.en.txt b/exam_final/subjects/5-0-last_word/subject.en.txt new file mode 100644 index 0000000..35d242c --- /dev/null +++ b/exam_final/subjects/5-0-last_word/subject.en.txt @@ -0,0 +1,25 @@ +Assignment name : last_word +Expected files : last_word.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes a string and displays its last word followed by a \n. + +A word is a section of string delimited by spaces/tabs or by the start/end of +the string. + +If the number of parameters is not 1, or there are no words, display a newline. + +Example: + +$> ./last_word "FOR PONIES" | cat -e +PONIES$ +$> ./last_word "this ... is sparta, then again, maybe not" | cat -e +not$ +$> ./last_word " " | cat -e +$ +$> ./last_word "a" "b" | cat -e +$ +$> ./last_word " lorem,ipsum " | cat -e +lorem,ipsum$ +$> diff --git a/exam_final/subjects/5-0-last_word/subject.fr.txt b/exam_final/subjects/5-0-last_word/subject.fr.txt new file mode 100644 index 0000000..a488c2e --- /dev/null +++ b/exam_final/subjects/5-0-last_word/subject.fr.txt @@ -0,0 +1,27 @@ +Assignment name : last_word +Expected files : last_word.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Écrire un programme qui prend une chaîne de caractères en paramètre, et qui +affiche le dernier mot de cette chaîne, suivi d'un '\n'. + +On appelle "mot" une portion de chaîne de caractères délimitée soit par des +espaces et/ou des tabulations, soit par le début / fin de la chaîne. + +Si le nombre de paramètres transmis est différent de 1, ou s'il n'y a aucun mot +à afficher, le programme affiche '\n'. + +Exemple: + +$> ./last_word "FOR PONY" | cat -e +PONY$ +$> ./last_word "this ... is sparta, then again, maybe not" | cat -e +not$ +$> ./last_word " " | cat -e +$ +$> ./last_word "a" "b" | cat -e +$ +$> ./last_word " lorem,ipsum " | cat -e +lorem,ipsum$ +$> |
