diff --git a/src/main.rs b/src/main.rs index cec0e89..3b6f186 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,7 +46,6 @@ pub mod u6; pub mod u7; pub mod u8; pub mod u9; -mod utils; fn main() { let ulohy = vec![ diff --git a/src/u11.rs b/src/u11.rs index da0f5d9..d712c7c 100644 --- a/src/u11.rs +++ b/src/u11.rs @@ -1 +1,13 @@ -pub fn main() {} +pub fn main() { + let mut input = String::new(); + println!("zadajte meno"); + std::io::stdin().read_line(&mut input).unwrap(); + let input = input.trim(); + if !input.chars().all(|c| c.is_alphabetic()) { + println!("Nespravny vstup, zadajte len pismena"); + panic!("Invalid input"); + } + let mut input = input.to_lowercase(); + input = input.chars().enumerate().map(|(i, c)| if i == 0 { c.to_uppercase().next().unwrap() } else { c }).collect(); + println!("{}", input); +} diff --git a/src/utils.rs b/src/utils.rs deleted file mode 100644 index ae1b21d..0000000 --- a/src/utils.rs +++ /dev/null @@ -1,23 +0,0 @@ -use turtle::Point; - -pub struct Vec2 { - pub x: f64, - pub y: f64, -} - -impl Vec2 { - pub fn new(x: f64, y: f64) -> Self { - Self { x, y } - } - - pub fn from_points(p1: Point, p2: Point) -> Self { - Self { - x: p2.x - p1.x, - y: p2.y - p1.y, - } - } - - pub fn size(&self) -> f64 { - (self.x.powi(2) + self.y.powi(2)).sqrt() - } -}