diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-21 13:49:01 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-21 13:49:01 +0200 |
| commit | 6a8ffb8823e1bdca56b8058e496479b65d0a6f6f (patch) | |
| tree | da6300a879112dce942fc6efdb221201caba4831 /rush00/ex01/rush01.rs | |
| parent | aef0e5fc3f4fdaa20d9334ac635d907cff82f2ba (diff) | |
| download | piscine-master.tar.gz piscine-master.tar.bz2 piscine-master.zip | |
Diffstat (limited to 'rush00/ex01/rush01.rs')
| -rw-r--r-- | rush00/ex01/rush01.rs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/rush00/ex01/rush01.rs b/rush00/ex01/rush01.rs new file mode 100644 index 0000000..70e1534 --- /dev/null +++ b/rush00/ex01/rush01.rs @@ -0,0 +1,52 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* rush01.rs :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/05/21 13:38:25 by charles #+# #+# */ +/* Updated: 2020/05/21 13:38:25 by charles ### ########.fr */ +/* */ +/* ************************************************************************** */ + +pub fn rush(x: i32, y: i32) { + if x == 0 || y == 0 { + return ; + } + + if x >= 1 { + print!("/"); + } + for _ in 1..x - 1 { + print!("*"); + } + if x >= 2 { + print!("\\"); + } + print!("\n"); + + for _ in 1..y - 1 { + print!("*"); + for _ in 1..x - 1 { + print!(" "); + } + if x >= 2 { + print!("*"); + } + print!("\n"); + } + + if y > 1 { + if x >= 1 { + print!("\\"); + } + for _ in 1..x - 1 { + print!("*"); + } + if x >= 2 { + print!("/"); + } + print!("\n"); + } +} |
