Browse Source

subject of itoabse fix and add of fr version of itoabaseprogram

content-update
Christopher Fremond 5 years ago committed by Christopher Fremond
parent
commit
1e653557b4
  1. 2
      subjects/itoabase.en.md
  2. 2
      subjects/itoabase.fr.md
  3. 14
      subjects/itoabaseprog.en.md
  4. 37
      subjects/itoabaseprog.fr.md

2
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

2
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

14
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$
```
```

37
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$
```
Loading…
Cancel
Save