aboutsummaryrefslogtreecommitdiff
path: root/rush00/ex02
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-21 13:49:01 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-21 13:49:01 +0200
commit6a8ffb8823e1bdca56b8058e496479b65d0a6f6f (patch)
treeda6300a879112dce942fc6efdb221201caba4831 /rush00/ex02
parentaef0e5fc3f4fdaa20d9334ac635d907cff82f2ba (diff)
downloadpiscine-6a8ffb8823e1bdca56b8058e496479b65d0a6f6f.tar.gz
piscine-6a8ffb8823e1bdca56b8058e496479b65d0a6f6f.tar.bz2
piscine-6a8ffb8823e1bdca56b8058e496479b65d0a6f6f.zip
Rush00 in Rust???HEADmaster
Diffstat (limited to 'rush00/ex02')
-rw-r--r--rush00/ex02/main.rs17
-rw-r--r--rush00/ex02/rush02.rs52
2 files changed, 69 insertions, 0 deletions
diff --git a/rush00/ex02/main.rs b/rush00/ex02/main.rs
new file mode 100644
index 0000000..3a14d63
--- /dev/null
+++ b/rush00/ex02/main.rs
@@ -0,0 +1,17 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* main.rs :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/21 12:35:44 by charles #+# #+# */
+/* Updated: 2020/05/21 13:38:07 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+mod rush02;
+
+fn main() {
+ rush02::rush(5, 5);
+}
diff --git a/rush00/ex02/rush02.rs b/rush00/ex02/rush02.rs
new file mode 100644
index 0000000..1f8e519
--- /dev/null
+++ b/rush00/ex02/rush02.rs
@@ -0,0 +1,52 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* rush02.rs :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/05/21 13:38:19 by charles #+# #+# */
+/* Updated: 2020/05/21 13:40:00 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+pub fn rush(x: i32, y: i32) {
+ if x == 0 || y == 0 {
+ return ;
+ }
+
+ if x >= 1 {
+ print!("A");
+ }
+ for _ in 1..x - 1 {
+ print!("B");
+ }
+ if x >= 2 {
+ print!("A");
+ }
+ print!("\n");
+
+ for _ in 1..y - 1 {
+ print!("B");
+ for _ in 1..x - 1 {
+ print!(" ");
+ }
+ if x >= 2 {
+ print!("B");
+ }
+ print!("\n");
+ }
+
+ if y > 1 {
+ if x >= 1 {
+ print!("C");
+ }
+ for _ in 1..x - 1 {
+ print!("B");
+ }
+ if x >= 2 {
+ print!("C");
+ }
+ print!("\n");
+ }
+}