1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/// A struct containing basic math operators.
///
/// # Examples
///
/// ```
///use C4lc::Operators;
///fn main() {
/// let ops = Operators::new();
///
/// println!("Type your number to be added\n");
///
/// let mut input = String::new();
/// std::io::stdin().read_line(&mut input).expect("Failed to read input");
///
/// let input: f64 = match input.trim().parse() {
/// Ok(num) => num,
/// Err(_) => {
/// println!("Not a valid input!");
/// return;
/// }
/// };
///
/// println!("\nType your second number\n");
/// let mut input2 = String::new();
/// std::io::stdin().read_line(&mut input2).expect("Failed to read input");
///
/// let input2: f64 = match input2.trim().parse() {
/// Ok(num) => num,
/// Err(_) => {
/// println!("Not a valid input!");
/// return;
/// }
/// };
///
/// let answer = match ops.addition {
/// '+' => input + input2, // matches the char and if the wrong symbol is used, the result will be wrong
/// _ => input,
/// };
///
/// println!("\n{} + {} is: {}", input, input2, answer);
/// }
/// ```
/// There's a struct declared with the required fields to be accessed.
/// They're public and can be accessed in project directory if the crate is added to your project.
/// Only the symbols defined are the ones tied to the fields.