commit 6b6ef82e772434560df85178f713da49ca4c8c21 Author: VincentKnightTesting Date: Mon Mar 14 12:43:39 2022 -0500 new repo, adding new project :) diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..463e110 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "mass_project" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f79cff1 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "mass_project" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..f898288 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,85 @@ +use std::io; + +fn main() { + let mut wack = String::new(); + + f_to_c(); + + println!("Do you want to hear the singing? (y/n): "); + + io::stdin() + .read_line(&mut wack) + .expect("ay yo that ain't it chief"); + let choice: &str = wack.trim(); + let mut done = false; + while done == false{ + + if choice == "y" || choice == "n"{ + if choice == "y"{ + done = true; + sing_goddamn_it(); + } + else{ + done = true; + } + } + else{ + println!("man try again..."); + } + } + + println!("{}",fibbonacci(-10)); +} + +fn f_to_c() { + + let mut s = String::new(); + + println!("Type a float to be a fahrenheit: "); + + io::stdin() + .read_line(&mut s) + .expect("Failed to read number, or number was formatted as an integer. Try putting a .0 at the end of the number..."); + + let x: f32 = s.trim().parse().unwrap(); + let y = (x - 32.0)*(5.0/9.0); + + println!("Fahrenheit: {} to Celsius: {}",x, y); +} + +fn sing_goddamn_it() { + let sents = ["a partridge in a pear tree", "2 turtle-doves", "3 French hens", "4 calling birds", "5 golden rings", "6 geese a-laying", + "7 swans a-swimming", "8 maids a-milking", "9 ladies dancing", "10 lords a-leaping", "11 pipers piping", "12 drummers drumming"]; + let mut days = 1; + + for _number in 1..13{ + println!("On the {} day of christmas, my true love sent to me", days); + for number2 in (0..0+days).rev(){ + println!("{}", sents[number2]); + } + days += 1; + } + +} + +fn fibbonacci(n: i32) -> i32{ + if n < 0 + { + panic!("{} is a negative number, mucho no bueno...", n); + }else if n == 0{ + panic!("equals zero, error"); + }else if n == 1{ + return 1; + } + + let mut sum = 0; + let mut temp = 0; + let mut temp2 = 1; + + for _i in 1..n { + sum = temp + temp2; + temp = temp2; + temp2 = sum; + } + sum +}