diff --git a/Cargo.lock b/Cargo.lock index 205a783..622b358 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 3 [[package]] name = "Rust-Calculator" -version = "5.0.0" +version = "6.0.0" diff --git a/Cargo.toml b/Cargo.toml index 419b1fa..79cf929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "Rust-Calculator" -version = "5.0.0" +version = "6.0.0" edition = "2021" [dependencies] diff --git a/README.md b/README.md index 153afb9..8c0230a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ A simple calculator I made in Rust. -[Link to use my calculator.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=858017901fb26534d389ff307eb3ed90) +[Link to use my calculator.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ab3adb77f6d876028d148495067f8331) All you need to do is click the run button in the top left corner and than follow the instructions in the terminal. \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 9a5cb95..14fd66e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ fn main() { let mut num1_string = String::new(); let mut num2_string = String::new(); - println!("Please type the first number and hit enter."); + println!("Please type the first number and hit enter. (if you want to use pi type 3.14 in this)"); num1_string.clear(); io::stdin().read_line(&mut num1_string).unwrap(); @@ -32,7 +32,7 @@ fn main() { println!("You selected {}", num1_string); - println!("Please type the second number and hit enter."); + println!("Please type the second number and hit enter. (if you want to use pi type 3.14 in this)"); num2_string.clear(); io::stdin().read_line(&mut num2_string).unwrap(); @@ -56,7 +56,21 @@ fn main() { } fn solve (num1: f64,sym:String,num2:f64){ - let answer:f64; + let answer:f64; + + if num2 == 3.14 { + let _ = num2 == 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989; + } + else { + + } + + if num1 == 3.14 { + let _ = num1 == 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989; + } + else { + + } if sym == "*" { answer = num1*num2;