pub struct Equation { /* private fields */ }Expand description
Equation struct that can be used to solve equations with two numbers and an operator (+, -, *, /, %, ^) Sol is the solution to the equation and is calculated when get_sol() is called.
Example
use numbers_rus::Equation;
let mut equation = Equation::new(1, 2, '+');
assert_eq!(equation.get_sol(), 3);Implementations§
source§impl Equation
impl Equation
sourcepub fn set_a(&mut self, a: i128)
pub fn set_a(&mut self, a: i128)
sets the a value (first number) in the equation struct. This will reset the solution to 0 so that it will be recalculated when get_sol() is called.
sourcepub fn set_b(&mut self, b: i128)
pub fn set_b(&mut self, b: i128)
sets the b value (second number) in the equation struct. This will reset the solution to 0 so that it will be recalculated when get_sol() is called.
sourcepub fn set_operator(&mut self, operator: char)
pub fn set_operator(&mut self, operator: char)
sets the operator in the equation struct. This will reset the solution to 0 so that it will be recalculated when get_sol() is called.
sourcepub fn get_operator(&self) -> char
pub fn get_operator(&self) -> char
returns the operator