From 0ad92da557a17cf3809009a6fcfd37c3249078d4 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 21 Dec 2022 21:18:56 +0100 Subject: [PATCH] Version 1.0 --- annexe/exA_1.rs | 17 +++++++++++++++++ annexe/exA_2.rs | 17 +++++++++++++++++ etape1/ex1_1.rs | 17 +++++++++++++++++ etape1/ex1_2.rs | 17 +++++++++++++++++ etape2/ex2_1.rs | 17 +++++++++++++++++ etape2/ex2_2.rs | 17 +++++++++++++++++ etape2/ex2_3.rs | 17 +++++++++++++++++ etape2/ex2_4.rs | 17 +++++++++++++++++ etape2/ex2_5.rs | 17 +++++++++++++++++ etape2/ex2_6.rs | 17 +++++++++++++++++ etape2/ex2_7.rs | 17 +++++++++++++++++ etape2/ex2_8.rs | 17 +++++++++++++++++ etape3/ex3_1.rs | 17 +++++++++++++++++ etape3/ex3_2.rs | 17 +++++++++++++++++ etape3/ex3_3.rs | 17 +++++++++++++++++ etape3/ex3_4.rs | 17 +++++++++++++++++ etape3/ex3_5.rs | 17 +++++++++++++++++ etape3/ex3_6.rs | 17 +++++++++++++++++ etape3/ex3_7.rs | 17 +++++++++++++++++ etape3/ex3_8.rs | 17 +++++++++++++++++ etape4/ex4_1.rs | 17 +++++++++++++++++ etape4/ex4_2.rs | 17 +++++++++++++++++ etape4/ex4_3.rs | 17 +++++++++++++++++ etape4/ex4_4.rs | 17 +++++++++++++++++ etape4/ex4_5.rs | 17 +++++++++++++++++ etape4/ex4_6.rs | 17 +++++++++++++++++ etape4/ex4_7.rs | 17 +++++++++++++++++ etape4/ex4_8.rs | 17 +++++++++++++++++ etape5/ex5_1.rs | 17 +++++++++++++++++ etape5/ex5_2.rs | 17 +++++++++++++++++ etape5/ex5_3.rs | 17 +++++++++++++++++ etape5/ex5_4.rs | 17 +++++++++++++++++ etape5/ex5_5.rs | 17 +++++++++++++++++ etape5/ex5_6.rs | 17 +++++++++++++++++ etape6/ex6_1.rs | 17 +++++++++++++++++ etape6/ex6_2.rs | 17 +++++++++++++++++ etape6/ex6_3.rs | 17 +++++++++++++++++ etape6/ex6_4.rs | 17 +++++++++++++++++ etape6/ex6_5.rs | 17 +++++++++++++++++ etape6/ex6_6.rs | 17 +++++++++++++++++ etape6/ex6_7.rs | 17 +++++++++++++++++ etape7/ex7_1.rs | 17 +++++++++++++++++ etape7/ex7_2.rs | 17 +++++++++++++++++ etape7/ex7_3.rs | 17 +++++++++++++++++ etape7/ex7_4.rs | 17 +++++++++++++++++ etape7/ex7_5.rs | 17 +++++++++++++++++ etape7/ex7_6.rs | 17 +++++++++++++++++ etape7/ex7_7.rs | 17 +++++++++++++++++ etape8/ex8_1.rs | 17 +++++++++++++++++ etape8/ex8_2.rs | 17 +++++++++++++++++ etape8/ex8_3.rs | 17 +++++++++++++++++ etape8/ex8_4.rs | 17 +++++++++++++++++ etape8/ex8_5.rs | 17 +++++++++++++++++ etape8/ex8_6.rs | 17 +++++++++++++++++ 54 files changed, 918 insertions(+) diff --git a/annexe/exA_1.rs b/annexe/exA_1.rs index 952045d..47b4fe5 100644 --- a/annexe/exA_1.rs +++ b/annexe/exA_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let check : bool = true ; // suppose que c'est vrai assert ! (check == true) ; // vérifier l'erreur diff --git a/annexe/exA_2.rs b/annexe/exA_2.rs index 26e986a..0f89da5 100644 --- a/annexe/exA_2.rs +++ b/annexe/exA_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let check : bool = false ; // suppose que c'est faux assert ! (check == true) ; // vérifier l'erreur diff --git a/etape1/ex1_1.rs b/etape1/ex1_1.rs index 5fd73bb..1fb2446 100644 --- a/etape1/ex1_1.rs +++ b/etape1/ex1_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { println ! ("Bonjour, monde !") ; } diff --git a/etape1/ex1_2.rs b/etape1/ex1_2.rs index 85feaa8..1953b58 100644 --- a/etape1/ex1_2.rs +++ b/etape1/ex1_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { // définit une fonction nommée main println ! ("Bonjour, monde ! ") ; /* println!( ) est une commande utilisée pour afficher du contenu ou du texte. diff --git a/etape2/ex2_1.rs b/etape2/ex2_1.rs index 3e18a8b..728e2be 100644 --- a/etape2/ex2_1.rs +++ b/etape2/ex2_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let var = "OK" ; println! ("La valeur de var est : { }", var); diff --git a/etape2/ex2_2.rs b/etape2/ex2_2.rs index 22e7cff..1b287e6 100644 --- a/etape2/ex2_2.rs +++ b/etape2/ex2_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let var : i32 = 100 ; let str : String = "Bonne".to_string() ; diff --git a/etape2/ex2_3.rs b/etape2/ex2_3.rs index 8f2766d..fcc830f 100644 --- a/etape2/ex2_3.rs +++ b/etape2/ex2_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x = 100 ; let y = 200 ; diff --git a/etape2/ex2_4.rs b/etape2/ex2_4.rs index 143c2d3..656748e 100644 --- a/etape2/ex2_4.rs +++ b/etape2/ex2_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + const NUM : i32 = 100 ; fn main() { println ! ("La valeur de NUM est {}", NUM) ; diff --git a/etape2/ex2_5.rs b/etape2/ex2_5.rs index a87a090..2e16b23 100644 --- a/etape2/ex2_5.rs +++ b/etape2/ex2_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let var1 : f32 = 100.88 ; let var2 : i32 = var1 as i32 ; // var1 devient i32 diff --git a/etape2/ex2_6.rs b/etape2/ex2_6.rs index 7e02f59..b795835 100644 --- a/etape2/ex2_6.rs +++ b/etape2/ex2_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { funt(100, 200) ; // appelle la fonction } diff --git a/etape2/ex2_7.rs b/etape2/ex2_7.rs index a8e8fec..5e0e06c 100644 --- a/etape2/ex2_7.rs +++ b/etape2/ex2_7.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let num = funt(100) ; // appelle la fonction println ! ("La valeur de num est : { }", num) ; diff --git a/etape2/ex2_8.rs b/etape2/ex2_8.rs index 105a93c..b75cd42 100644 --- a/etape2/ex2_8.rs +++ b/etape2/ex2_8.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn foo() -> bool { // spécifier un type de retour return true // renvoie une valeur à l'appelant } diff --git a/etape3/ex3_1.rs b/etape3/ex3_1.rs index 33649f9..098adc4 100644 --- a/etape3/ex3_1.rs +++ b/etape3/ex3_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let (x, y) = (100, 200) ; // liaison de variable println ! ("La valeur de x est {}", x) ; diff --git a/etape3/ex3_2.rs b/etape3/ex3_2.rs index 73c20c8..aaa3689 100644 --- a/etape3/ex3_2.rs +++ b/etape3/ex3_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let mut a = 100 ; // liaison de variable let mut b = 200 ; diff --git a/etape3/ex3_3.rs b/etape3/ex3_3.rs index 2ffb92a..f172dab 100644 --- a/etape3/ex3_3.rs +++ b/etape3/ex3_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x = "hello".to_string() ; let y = String::from("hello") ; diff --git a/etape3/ex3_4.rs b/etape3/ex3_4.rs index f55b853..1a12f15 100644 --- a/etape3/ex3_4.rs +++ b/etape3/ex3_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { println ! ("10 + 2 = {}", 10 + 2) ; println ! ("10 - 2 = {}", 10 - 2) ; diff --git a/etape3/ex3_5.rs b/etape3/ex3_5.rs index 0d62730..93ac6f1 100644 --- a/etape3/ex3_5.rs +++ b/etape3/ex3_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { println ! ("true AND false is {}", true && false) ; println ! ("true OR false is {}", true || false) ; diff --git a/etape3/ex3_6.rs b/etape3/ex3_6.rs index 978af32..70e2647 100644 --- a/etape3/ex3_6.rs +++ b/etape3/ex3_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let x : i32 = 100 ; let y : i32 = 200 ; diff --git a/etape3/ex3_7.rs b/etape3/ex3_7.rs index 0fe95d8..674ef8c 100644 --- a/etape3/ex3_7.rs +++ b/etape3/ex3_7.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let mut a : [i32 ; 4] = [8 ; 4] ; // créer un tableau a[1] = 10 ; diff --git a/etape3/ex3_8.rs b/etape3/ex3_8.rs index 0ad8807..bc79654 100644 --- a/etape3/ex3_8.rs +++ b/etape3/ex3_8.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let a :[f32 ; 4] = [0.1, 0.2, 0.3, 0.4] ; // créer un tableau println ! ("{} {} {} {}",a[0],a[1],a[2],a[3]) diff --git a/etape4/ex4_1.rs b/etape4/ex4_1.rs index 9661e23..e97a9b4 100644 --- a/etape4/ex4_1.rs +++ b/etape4/ex4_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let num=10 ; if num==10 { diff --git a/etape4/ex4_2.rs b/etape4/ex4_2.rs index 7f7afdd..7c0fba2 100644 --- a/etape4/ex4_2.rs +++ b/etape4/ex4_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let x=100 ; let y=200 ; diff --git a/etape4/ex4_3.rs b/etape4/ex4_3.rs index 175bef3..3c018ec 100644 --- a/etape4/ex4_3.rs +++ b/etape4/ex4_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let num = if true { // instruction let-if 100 diff --git a/etape4/ex4_4.rs b/etape4/ex4_4.rs index ac39d71..60e2349 100644 --- a/etape4/ex4_4.rs +++ b/etape4/ex4_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let mut num=5 ; loop { // instruction de boucle diff --git a/etape4/ex4_5.rs b/etape4/ex4_5.rs index 3608487..8d22af5 100644 --- a/etape4/ex4_5.rs +++ b/etape4/ex4_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ for num in 5..9 { // "5 .. 9" contient les nombres de 5 à 8 println ! ("Cela va durer {} heures", num) ; diff --git a/etape4/ex4_6.rs b/etape4/ex4_6.rs index 5837922..e35355d 100644 --- a/etape4/ex4_6.rs +++ b/etape4/ex4_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let mut num=0 ; while num<=8 { // instruction while diff --git a/etape4/ex4_7.rs b/etape4/ex4_7.rs index d78d107..4104eaf 100644 --- a/etape4/ex4_7.rs +++ b/etape4/ex4_7.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let t = ("Nous nous levons à", 8,"Heures",true); // crée un tuple print!("{} {} {} {}\n",t.0,t.1,t.2,t.3 ) ; // accède aux éléments diff --git a/etape4/ex4_8.rs b/etape4/ex4_8.rs index d659c98..e94bedf 100644 --- a/etape4/ex4_8.rs +++ b/etape4/ex4_8.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let num:i32 = 3 ; // expression donnée match num { diff --git a/etape5/ex5_1.rs b/etape5/ex5_1.rs index 2292998..9868236 100644 --- a/etape5/ex5_1.rs +++ b/etape5/ex5_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + struct Member { // créer une structure id : i32, // member : type name : String, diff --git a/etape5/ex5_2.rs b/etape5/ex5_2.rs index 95bc143..1b20c36 100644 --- a/etape5/ex5_2.rs +++ b/etape5/ex5_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + struct Square { // crée une structure len : i32, wid : i32, diff --git a/etape5/ex5_3.rs b/etape5/ex5_3.rs index 0ecd862..60f527f 100644 --- a/etape5/ex5_3.rs +++ b/etape5/ex5_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + enum Langage { // définit un enum JS, // membre Rust, diff --git a/etape5/ex5_4.rs b/etape5/ex5_4.rs index 4bb8dd8..a2282df 100644 --- a/etape5/ex5_4.rs +++ b/etape5/ex5_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x = String::from("E2L") ; // x est propriétaire de "E2L". diff --git a/etape5/ex5_5.rs b/etape5/ex5_5.rs index a3d4777..fbbf93e 100644 --- a/etape5/ex5_5.rs +++ b/etape5/ex5_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let s =String::from("Il fait beau") ; // s est propriétaire // de "Il fait beau". diff --git a/etape5/ex5_6.rs b/etape5/ex5_6.rs index ca9df16..7928fd4 100644 --- a/etape5/ex5_6.rs +++ b/etape5/ex5_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let s=String :: from("Vive le Rust !"); let n=cal( &s ); // reference diff --git a/etape6/ex6_1.rs b/etape6/ex6_1.rs index 73a0450..519aa52 100644 --- a/etape6/ex6_1.rs +++ b/etape6/ex6_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod mon_module { // définit un module pub fn test(){ // pub signifie attribut public println ! ("Bonjour mes amis ! ") ; diff --git a/etape6/ex6_2.rs b/etape6/ex6_2.rs index 97bcd66..de9e6de 100644 --- a/etape6/ex6_2.rs +++ b/etape6/ex6_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod m1{ pub fn a(){ println ! ("module m1") ; diff --git a/etape6/ex6_3.rs b/etape6/ex6_3.rs index 2ff7764..9c670e6 100644 --- a/etape6/ex6_3.rs +++ b/etape6/ex6_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + pub fn ex_fun() { println ! ("{}", "Texte externe") ; } diff --git a/etape6/ex6_4.rs b/etape6/ex6_4.rs index a02b7b1..3fb9d89 100644 --- a/etape6/ex6_4.rs +++ b/etape6/ex6_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod ex6_3 ; // charge un fichier externe use ex6_3::ex_fun ; // charge une fonction externe fn main () { diff --git a/etape6/ex6_5.rs b/etape6/ex6_5.rs index b90ee87..b110f97 100644 --- a/etape6/ex6_5.rs +++ b/etape6/ex6_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod mon_module { pub fn a() { // la fonction est publique println ! ("fonction a") ; diff --git a/etape6/ex6_6.rs b/etape6/ex6_6.rs index 54b689e..43c5cd8 100644 --- a/etape6/ex6_6.rs +++ b/etape6/ex6_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod mon_module { pub fn a() { println ! ("fonction a") ; diff --git a/etape6/ex6_7.rs b/etape6/ex6_7.rs index 89a58ca..edc6524 100644 --- a/etape6/ex6_7.rs +++ b/etape6/ex6_7.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + mod sup_module{ // module parent fn a() -> i32 { 100 diff --git a/etape7/ex7_1.rs b/etape7/ex7_1.rs index ceadca7..cc8972a 100644 --- a/etape7/ex7_1.rs +++ b/etape7/ex7_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let v = vec ![100, 200, 300, 400] ; // crée un vecteur println ! ("Le premier élément est : {}",v[0]) ; // accède au premier élément diff --git a/etape7/ex7_2.rs b/etape7/ex7_2.rs index 4cc28e1..64a2eca 100644 --- a/etape7/ex7_2.rs +++ b/etape7/ex7_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let v =vec ! [8 ; 3] ; // répété trois fois println ! ("Le premier élément est : {}",v[0]) ; diff --git a/etape7/ex7_3.rs b/etape7/ex7_3.rs index 8a480ad..ae1d95b 100644 --- a/etape7/ex7_3.rs +++ b/etape7/ex7_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let mut v=Vec::new() ; // crée un vecteur v . push('R') ; // définit R comme le premier élément du vecteur diff --git a/etape7/ex7_4.rs b/etape7/ex7_4.rs index 87fee55..6f41282 100644 --- a/etape7/ex7_4.rs +++ b/etape7/ex7_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let num = 3 ; match num { diff --git a/etape7/ex7_5.rs b/etape7/ex7_5.rs index d02e958..9a86179 100644 --- a/etape7/ex7_5.rs +++ b/etape7/ex7_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x = 3 ; match x { diff --git a/etape7/ex7_6.rs b/etape7/ex7_6.rs index 9a4dc6d..570c63e 100644 --- a/etape7/ex7_6.rs +++ b/etape7/ex7_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x = 5 ; match x { diff --git a/etape7/ex7_7.rs b/etape7/ex7_7.rs index 81abea3..922de53 100644 --- a/etape7/ex7_7.rs +++ b/etape7/ex7_7.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let x : Option = Some(true) ; // paramètres génériques let y : Option = Some(10) ; diff --git a/etape8/ex8_1.rs b/etape8/ex8_1.rs index df82c5d..6386ac9 100644 --- a/etape8/ex8_1.rs +++ b/etape8/ex8_1.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + struct Circle{ // création d'une structure de type radius : f32, // membre de la structure } diff --git a/etape8/ex8_2.rs b/etape8/ex8_2.rs index 130980c..abff826 100644 --- a/etape8/ex8_2.rs +++ b/etape8/ex8_2.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + struct Cercle{ // créez une structure de type rayon : f32, // membre de la structure } diff --git a/etape8/ex8_3.rs b/etape8/ex8_3.rs index b6794b3..8453311 100644 --- a/etape8/ex8_3.rs +++ b/etape8/ex8_3.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + pub trait Show { // définit un trait fn show(&self) ; // définition d'une méthode de trait } diff --git a/etape8/ex8_4.rs b/etape8/ex8_4.rs index adf72f6..75d40e7 100644 --- a/etape8/ex8_4.rs +++ b/etape8/ex8_4.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + struct Jeu { numero : i32, } diff --git a/etape8/ex8_5.rs b/etape8/ex8_5.rs index b23b229..aa4795c 100644 --- a/etape8/ex8_5.rs +++ b/etape8/ex8_5.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main(){ let ma_fermeture = | num : i32 | { num+200 }; //crée une fermeture let num = 100 ; diff --git a/etape8/ex8_6.rs b/etape8/ex8_6.rs index 6682867..ba4a444 100644 --- a/etape8/ex8_6.rs +++ b/etape8/ex8_6.rs @@ -1,3 +1,20 @@ +/* Copyright (C) 2011-2023 Patrick H. E. Foubet - E2L Ivry +Ecole du Logiciel Libre : https://e2li.org/ + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*******************************************************************/ + fn main() { let mut capacity = "Capacité du disque dur : 5000".to_string() ; {