th3abhi97 / simple-calc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple-calc

INFO 449 - HW2 - SimpleCalc

It is a console calculator.

Usage Directions

  • Enter a number(s) seperated by spaces then hit return
  • Enter an operation then hit return
  • Operations supported are:
    • Add: +
    • Subtract: -
    • Multiply: *
    • Divide: /
    • Modulus: %
    • Factorial: fact
    • Average: avg
    • Count: count
    • Sum: sum
  • Enter another number if the operation was +, -, /, %, * and then hit return
  • fact only supports single number input
The program then calculates the result.

Example Usage


$ SimpleCalc
Enter an expression separated by returns:
15
+
27
Result: 42


$ SimpleCalc
Enter an expression separated by returns:
15
-
27
Result: -12


$ SimpleCalc
Enter an expression separated by returns:
10 4 25 17 5
count
Result: 5


$ SimpleCalc
Enter an expression separated by returns:
5
fact
Result: 120

About


Languages

Language:Swift 100.0%