Permalink
Browse files

Merged.

  • Loading branch information...
2 parents 5c97fe0 + c49c585 commit 121b8efd748c0182b6ef1803710c79b4406e421a Yuki Okubo committed Jun 23, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 calc.rb
View
13 calc.rb
@@ -1,12 +1,12 @@
case ARGV[3]
when '+'
- p ARGV[0], ARGV[1], ARGV[3]
+ p plus(ARGV[1].to_i, ARGV[2].to_i)
when '-'
- p ARGV[0], ARGV[1], ARGV[3]
+ p minus(ARGV[1].to_i, ARGV[2].to_i)
when '*'
- p ARGV[0], ARGV[1], ARGV[3]
+ p (ARGV[1].to_i, ARGV[2].to_i)
when '/'
- div(ARGV[1], ARGV[3])
+ p div(ARGV[1].to_i, ARGV[2].to_i)
else
exit
end
@@ -15,4 +15,7 @@ def div( op1, op2 )
return op1/op2
end
-p div(10,4)
+def plus( operand1, operand2 )
+ result = operand1 + operand2
+ return result
+end

0 comments on commit 121b8ef

Please sign in to comment.