Browse Source

Doop Operators and Overflow

pull/349/head
OGordoo 5 years ago committed by Xavier Petit
parent
commit
3bdc916af3
  1. 6
      subjects/doop.en.md

6
subjects/doop.en.md

@ -10,10 +10,14 @@ The program has to be used with three arguments:
- An operator - An operator
- Another value - Another value
The following operators are considered valid: "+", "-", "/", "*", "%".
In case of an invalid operator the programs prints `0`. In case of an invalid operator the programs prints `0`.
In case of an invalid number of arguments the program prints nothing. In case of an invalid number of arguments the program prints nothing.
In case of overflow the program prints **Overflow**.
The program has to handle the modulo and division operations by 0 as shown on the output examples below. The program has to handle the modulo and division operations by 0 as shown on the output examples below.
`fmt.Print` is authorized. `fmt.Print` is authorized.
@ -33,6 +37,8 @@ student@ubuntu:~/piscine-go/test$ ./doop 1 / 0 | cat -e
No division by 0$ No division by 0$
student@ubuntu:~/piscine-go/test$ ./doop 1 % 0 | cat -e student@ubuntu:~/piscine-go/test$ ./doop 1 % 0 | cat -e
No Modulo by 0$ No Modulo by 0$
student@ubuntu:~/piscine-go/test$ ./doop 9223372036854775807 + 1
Overflow
student@ubuntu:~/piscine-go/test$ ./doop 1 "*" 1 student@ubuntu:~/piscine-go/test$ ./doop 1 "*" 1
1 1
student@ubuntu:~/piscine-go/test$ ./doop 1 "*" -1 student@ubuntu:~/piscine-go/test$ ./doop 1 "*" -1

Loading…
Cancel
Save