Skip to content

anatolethien/doop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

doop

Instructions

Write a program that is called doop.

The program has to be used with three arguments:

  • A value
  • An operator, one of : +, -, /, *, %
  • Another value

In case of an invalid operator, value, number of arguments or an overflow the programs prints nothing.

The program has to handle the modulo and division operations by 0 as shown on the output examples below.

Usage

student@ubuntu:~/doop$ go build
student@ubuntu:~/doop$ ./doop
student@ubuntu:~/doop$ ./doop 1 + 1 | cat -e
2
student@ubuntu:~/doop$ ./doop hello + 1
student@ubuntu:~/doop$ ./doop 1 p 1
student@ubuntu:~/doop$ ./doop 1 / 0 | cat -e
No division by 0
student@ubuntu:~/doop$ ./doop 1 % 0 | cat -e
No modulo by 0
student@ubuntu:~/doop$ ./doop 9223372036854775807 + 1
0
student@ubuntu:~/doop$ ./doop -9223372036854775809 - 3
0
student@ubuntu:~/doop$ ./doop 9223372036854775807 "*" 3
0
student@ubuntu:~/doop$ ./doop 1 "*" 1
1
student@ubuntu:~/doop$ ./doop 1 "*" -1
-1
student@ubuntu:~/doop$

About

Simple calculator program written in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages