Skip to content

Latest commit

 

History

History

ios_calculator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Rusty iOS Calculator

Crates.io version

An implementation of the basic iOS calculator featuring:

  • DMAS (division, muliplication, addition, subtraction) operations
  • Decimalisation
  • Memory of last calculation
  • Percentage conversion

Example

use ios_calculator::{Calculator, Operator};

let mut calc = Calculator::new();

calc.submit_number(1);
calc.submit_decimal();
calc.submit_number(2);
calc.submit_operator(Operator::add());
calc.submit_number(2);
calc.submit_equals();

assert_eq!(
    calc.output().value(),
    3.2,
);

assert_eq!(
    calc.output().to_string(),
    "3.2",
);