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,20 @@
Assignment name : ft_atoi_base
Expected files : ft_atoi_base.c
Allowed functions: None
--------------------------------------------------------------------------------
Write a function that converts the string argument str (base N <= 16)
to an integer (base 10) and returns it.
The characters recognized in the input are: 0123456789abcdef
Those are, of course, to be trimmed according to the requested base. For
example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef".
Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3".
Minus signs ('-') are interpreted only if they are the first character of the
string.
Your function must be declared as follows:
int ft_atoi_base(const char *str, int str_base);

View File

@@ -0,0 +1,21 @@
Assignment name : ft_atoi_base
Expected files : ft_atoi_base.c
Allowed functions: None
--------------------------------------------------------------------------------
Écrire une fonction qui convertit son argument 'str', une chaîne (en base N <= 16)
en un entier (base 10) et le retourne.
Les caractères reconnus dans l'entrée sont : 0123456789abcdef
Bien entendu, la base demandée conditionne le nombre de caractères à prendre
en compte. Par exemple, la base 4 reconnaîtra "0123" et la base 16 reconnaîtra
"0123456789abcdef".
Les majuscules marchent aussi : "12fdb3" est pareil que "12FDB3".
Les caractères '-' doivent être interprétés seulement s'ils sont en première
position dans la chaîne.
Votre fonction sera déclarée comme suit:
int ft_atoi_base(const char *str, int str_base);