Skip to content

Commit

Permalink
V6 added pi
Browse files Browse the repository at this point in the history
  • Loading branch information
ExoticDG committed Jul 9, 2024
1 parent eabb05d commit 7fc3799
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "Rust-Calculator"
version = "5.0.0"
version = "6.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 17 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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;
Expand Down

0 comments on commit 7fc3799

Please sign in to comment.