Browse Source

en and fr subject for reversebits

content-update
Christopher Fremond 5 years ago committed by Christopher Fremond
parent
commit
92f02edc29
  1. 6
      subjects/reversebits.en.md
  2. 36
      subjects/reversebits.fr.md

6
subjects/reversebits.en.md

@ -13,7 +13,7 @@ This means that:
### Instructions ### Instructions
Write a function that takes a `byte` in binary format, that reverses it `bit` by `bit` (as shown in the example) and returns the result Write a function that takes a `byte`, reverses it `bit` by `bit` (as shown in the example) and returns the result.
### Expected function ### Expected function
@ -24,7 +24,7 @@ func ReverseBits(by byte) byte {
``` ```
### Usage ### Usage
Here is a possible [program](TODO-LINK) to test your function : Here is a possible program to test your function :
```go ```go
package main package main
@ -40,7 +40,7 @@ func main() {
} }
``` ```
### Expected output and its output :
```console ```console
student@ubuntu:~/piscine-go/reversebits$ go build student@ubuntu:~/piscine-go/reversebits$ go build

36
subjects/reversebits.fr.md

@ -2,19 +2,39 @@
### Instructions ### Instructions
Écrire un programme qui prend un `byte`, qui l'inverse `bit` par `bit` (comme montré sur l'exemple) et qui affiche le résultat. Écrire une fonction qui prend un `byte`, qui l'inverse `bit` par `bit` (comme montré sur l'exemple) et qui retourne le résultat.
### Fonction attendue
```go
func ReverseBits(by byte) byte {
}
```
### Utilisation ### Utilisation
Voici un programme possible pour tester votre fonction :
```go
package main
import (
"fmt"
)
func main() {
a := byte(0x26)
fmt.Printf("%08b\n", a)
fmt.Printf("%08b\n", ReverseBits(a))
}
```
et son résultat :
```console ```console
student@ubuntu:~/piscine-go/reversebits$ go build student@ubuntu:~/piscine-go/reversebits$ go build
student@ubuntu:~/piscine-go/reversebits$ ./reversebits student@ubuntu:~/piscine-go/reversebits$ ./reversebits
Not enough arguments. 00100110
student@ubuntu:~/piscine-go/reversebits$ ./reversebits 00100110 | cat -e 01100100
01100100$
student@ubuntu:~/piscine-go/reversebits$ ./reversebits "djs"
The argument "djs" does not represent a byte
student@ubuntu:~/piscine-go/reversebits$ ./reversebits "0102039s" | cat -e
The argument "0102039s" does not represent a byte$
student@ubuntu:~/piscine-go/reversebits$ student@ubuntu:~/piscine-go/reversebits$
``` ```

Loading…
Cancel
Save