You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
978 B

5 years ago
## doop
5 years ago
### Instructions
Écrire un [programme](TODO-LINK) qui s'apelle `doop`.
Le programme doit être utilisé avec trois arguments:
- Une valeur
- Un opérateur
- Une autre valeur
En cas d'opérateur invalide le programme affiche `0`.
En cas de nombre invalide d'arguments le programme affiche rien.
Le programme doit géré les opérations modulo et division par 0 comme dans les examples ci-dessous.
`fmt.Print` est autorisé.
5 years ago
### Utilisation
```console
student@ubuntu:~/[[ROOT]]/test$ go build doop.go
student@ubuntu:~/[[ROOT]]/test$ ./doop
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 + 1 | cat -e
2$
student@ubuntu:~/[[ROOT]]/test$ ./doop hello + 1 | cat -e
0$
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 p 1 | cat -e
0$
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 / 0 | cat -e
No division by 0$
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 % 0 | cat -e
5 years ago
No modulo by 0$
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 "*" 1
1
student@ubuntu:~/[[ROOT]]/test$ ./doop 1 "*" -1
-1
```