This commit is contained in:
Tanguy MAZE
2019-06-22 18:23:35 +02:00
commit f9e508d5ef
173 changed files with 6727 additions and 0 deletions

View File

@@ -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$
$>

View File

@@ -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$
$>

View File

@@ -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$
$>

View File

@@ -0,0 +1,27 @@
Exercitiu : last_word
Fisiere de iesire : last_word.c
Functii autorizate : write
--------------------------------------------------------------------------------
Scrieti un program ce ia ca parametru un sir de caractere si care afiseaza ultimul
cuvant al acestui sir urmat de '\n'.
Numim "cuvant" o portiune a sirului de caractere delimitat fie de spatii si/sau
tabulatoare, fie de incepulul ori sfarsitul sirului.
Daca numarul de parametri transmis este diferit de 1, sau nu exista nicun cuvant
de afisat, programul va afisa '\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$
$>