diff --git a/subjects/itoabase.en.md b/subjects/itoabase.en.md index 11005482..17ee139e 100644 --- a/subjects/itoabase.en.md +++ b/subjects/itoabase.en.md @@ -15,6 +15,8 @@ For example, the base `4` would be the equivalent of "0123" and the base `16` wo If the value is negative, the resulting `string` has to be preceded with a minus sign `-`. +Only valid inputs will be tested. + ### Expected function ```go diff --git a/subjects/itoabase.fr.md b/subjects/itoabase.fr.md index d287831f..30ed68b0 100644 --- a/subjects/itoabase.fr.md +++ b/subjects/itoabase.fr.md @@ -13,6 +13,8 @@ Par exemple, la base `4` sera équivalente à "0123" et la base `16` sera équiv Si la valeur est négative, la `string` résultante doit être précédée d'un signe moins `-`. +Seuls des arguments valables seront testés. + ### Fonction attendue ```go diff --git a/subjects/itoabaseprog.en.md b/subjects/itoabaseprog.en.md index 8f7e7277..bde834e5 100644 --- a/subjects/itoabaseprog.en.md +++ b/subjects/itoabaseprog.en.md @@ -5,7 +5,7 @@ Write a program that: - converts a number in base 10 into the number in the specified base -- the program receives two parameter: +- receives two parameters: - the first is the value - the second is the base @@ -25,15 +25,15 @@ student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 15 16 F student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 255 2 11111111 -student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -4 2 --100 +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -4 2 | cat -e +-100$ student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -df sdf -The value "-df" can not be converted to int -student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 23 ew -The value "ew" can not be converted to int +The value "-df" can not be converted to an int +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 23 ew | cat -e +The value "ew" can not be converted to an int$ student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 4 23 student@ubuntu:~/piscine-go/itoabaseprog$ 323 12 22B student@ubuntu:~/piscine-go/itoabaseprog$ -``` \ No newline at end of file +``` diff --git a/subjects/itoabaseprog.fr.md b/subjects/itoabaseprog.fr.md new file mode 100644 index 00000000..0e79c4a9 --- /dev/null +++ b/subjects/itoabaseprog.fr.md @@ -0,0 +1,37 @@ +## itoabaseprog + +### Instructions + +Écrire un programme qui: + +- convertit un nombre en base 10 en nombre dans la base spécifiée +- reçoit deux paramètres: + - le premier est la valeur + - le deuxième est la base + +Cette base est exprimée comme un `int`, de 2 à 16. Les caractères compris dans la base sont les chiffres de 0 à 9, suivis des lettres majuscules de A à F. + +Par exemple, la base `4` sera équivalente à "0123" et la base `16` sera équivalente à "0123456789ABCDEF". + +Si la valeur est négative, la `string` résultante doit être précédée d'un signe moins `-`. + +### Utilisation + +```console +student@ubuntu:~/piscine-go/itoabaseprog$ go build +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 15 16 +F +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 255 2 +11111111 +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -4 2 | cat -e +-100$ +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog -df sdf +The value "-df" can not be converted to an int +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 23 ew | cat -e +The value "ew" can not be converted to an int$ +student@ubuntu:~/piscine-go/itoabaseprog$ ./itoabaseprog 4 23 + +student@ubuntu:~/piscine-go/itoabaseprog$ 323 12 +22B +student@ubuntu:~/piscine-go/itoabaseprog$ +```