36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
/*
|
|
* Create a simple calculator
|
|
* I should be able to do basic add/sub/mult/divd and be able to use "()"
|
|
*
|
|
* 1. Take user input
|
|
* a. Check to see if there is a previous answer that we are going to act on
|
|
* 1. initialize answer to 0
|
|
* 2. if the user starts with an operand, the first number is "answer"
|
|
* else, start a new problem with whatever the user puts in
|
|
* b. Parse user input for ( ) / * - + in order to formulate a proper math problem
|
|
* 1. Strip trailing and leading white space
|
|
* 2. Check to see if there is a library that converts a string to a math problem
|
|
* c. check for the clear command
|
|
* 2. Calculate the answer
|
|
* a. Take
|
|
* 3. return the answer above a new prompt in a clered screen
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
fn main() {
|
|
let strNumber1;
|
|
let strNumber2;
|
|
let number: i32;
|
|
|
|
strNumber1 = "5";
|
|
strNumber2 = "6";
|
|
number = strNumber1.parse::<i32>().unwrap() + strNumber2.parse::<i32>().unwrap();
|
|
|
|
|
|
//let my_int = number.parse::<i32>().unwrap();
|
|
|
|
println!("Hello, world! Here's your number! {}", number);
|
|
}
|