u11
This commit is contained in:
parent
a9dc29cfad
commit
d28b93267f
3 changed files with 13 additions and 25 deletions
|
@ -46,7 +46,6 @@ pub mod u6;
|
||||||
pub mod u7;
|
pub mod u7;
|
||||||
pub mod u8;
|
pub mod u8;
|
||||||
pub mod u9;
|
pub mod u9;
|
||||||
mod utils;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let ulohy = vec![
|
let ulohy = vec![
|
||||||
|
|
14
src/u11.rs
14
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);
|
||||||
|
}
|
||||||
|
|
23
src/utils.rs
23
src/utils.rs
|
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue