Skip to content

Commit

Permalink
V6.5 Fixed Pi
Browse files Browse the repository at this point in the history
  • Loading branch information
ExoticDG committed Jul 9, 2024
1 parent 7fc3799 commit 6c36669
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 28 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 = "6.0.0"
version = "6.5.0"
edition = "2021"

[dependencies]
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
A simple calculator I made in Rust.


[Link to use my calculator.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ab3adb77f6d876028d148495067f8331)
[Link to use my calculator.](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3de045da59768cadb6697a88bfc97311)

All you need to do is click the run button in the top left corner and than follow the instructions in the terminal.
All you need to do is click the run button in the top left corner and than follow the instructions in the terminal.

Another way you can use this calculator is by downloading the files and running main.rs in your terminal.
104 changes: 80 additions & 24 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,45 +56,101 @@ fn main() {
}

fn solve (num1: f64,sym:String,num2:f64){
let answer:f64;
let mut answer:f64;
let pi1:f64;
let pi2:f64;

if num2 == 3.14 {
let _ = num2 == 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
pi2 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;


if sym == "*" {
answer = num1*pi2;
println!("The answer is {}", answer);
}
else if sym == "/" {
answer = num1/pi2;
println!("The answer is {}", answer);
}
else if sym == "-" {
answer = num1-pi2;
println!("The answer is {}", answer);

}
else if sym == "+" {
answer = num1+pi2;
println!("The answer is {}", answer);
}
else {
println!("Sorry. This is not a viable problem. Try again.")
};


}
else {

}

if num1 == 3.14 {
let _ = num1 == 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
pi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
println!("{}", pi1);

if sym == "*" {
answer = pi1*num2;
println!("The answer is {}", answer);
}
else if sym == "/" {
answer = pi1/num2;
println!("The answer is {}", answer);
}
else if sym == "-" {
answer = pi1-num2;
println!("The answer is {}", answer);

}
else if sym == "+" {
answer = pi1+num2;
println!("The answer is {}", answer);
}
else {
println!("Sorry. This is not a viable problem. Try again.")
};
}
else {

}

if sym == "*" {
answer = num1*num2;
println!("The answer is {}", answer);
}
else if sym == "/" {
answer = num1/num2;
println!("The answer is {}", answer);
}
else if sym == "-" {
answer = num1-num2;
println!("The answer is {}", answer);

if num1 == 3.14 {

}
else if num2 == 3.14 {

}
else {
if sym == "*" {
answer = num1*num2;
println!("The answer is {}", answer);
}
else if sym == "/" {
answer = num1/num2;
println!("The answer is {}", answer);
}
else if sym == "-" {
answer = num1-num2;
println!("The answer is {}", answer);

}
else if sym == "+" {
answer = num1+num2;
println!("The answer is {}", answer);
}
else {
println!("Sorry. This is not a viable problem. Try again.")
};
}
else if sym == "+" {
answer = num1+num2;
println!("The answer is {}", answer);
}
else {
println!("Sorry. This is not a viable problem. Try again.")
};
}

rerun()
}
}

fn rerun () {

Expand Down

0 comments on commit 6c36669

Please sign in to comment.