{"id":6011,"date":"2025-12-29T18:05:59","date_gmt":"2025-12-29T17:05:59","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=6011"},"modified":"2025-12-29T18:29:01","modified_gmt":"2025-12-29T17:29:01","slug":"projet-plus_moins-en-rust","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/","title":{"rendered":"projet plus_moins en RUST"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">cr\u00e9er le projet<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cargo new plus_moins<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">on obtient cela : dans le projet plus_moins<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u279c  plus_moins git:(master) \u2717 tree\n.\n\u251c\u2500\u2500 Cargo.lock\n\u251c\u2500\u2500 Cargo.toml\n\u2514\u2500\u2500 src\n    \u2514\u2500\u2500 main.rs\n\n1 directory, 3 files\n\u279c  plus_moins git:(master) \u2717 \n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Cargo.toml<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&#x5B;package]\nname = &quot;plus_moins&quot;\nversion = &quot;0.1.0&quot;\nedition = &quot;2021&quot;\n\n# See more keys and their definitions at https:\/\/doc.rust-lang.org\/cargo\/reference\/manifest.html\n\n&#x5B;dependencies]\nrand = &quot;0.9.2&quot;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\/src\/main.rs<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"rust\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">use rand::Rng;\nuse std::io;\n\nfn main() {\n    println!(\"\ud83c\udfaf JEU DU PLUS OU MOINS \ud83c\udfaf\");\n    println!(\"Devinez le nombre entre 1 et 100 !\");\n    \n    \/\/let nombre_secret = rand::thread_rng().gen_range(1..=100);\n    \/\/let mut tentatives = 0;\n\n    \/\/ Utilisez les nouvelles fonctions\n    let nombre_secret = rand::rng().random_range(1..=100);\n    let mut tentatives = 0;\n\n\n    loop {\n        println!(\"\\nEntrez votre proposition :\");\n        \n        let mut supposition = String::new();\n        \n        io::stdin()\n            .read_line(&amp;mut supposition)\n            .expect(\"\u00c9chec de la lecture de la ligne\");\n        \n        \/\/ Conversion en nombre\n        let supposition: u32 = match supposition.trim().parse() {\n            Ok(num) => num,\n            Err(_) => {\n                println!(\"\u274c Veuillez entrer un nombre valide !\");\n                continue;\n            }\n        };\n        \n        tentatives += 1;\n        \n        \/\/ Comparaison\n        match supposition.cmp(&amp;nombre_secret) {\n            std::cmp::Ordering::Less => println!(\"\ud83d\udcc8 PLUS ! ({} &lt; ?)\", supposition),\n            std::cmp::Ordering::Greater => println!(\"\ud83d\udcc9 MOINS ! ({} > ?)\", supposition),\n            std::cmp::Ordering::Equal => {\n                println!(\"\ud83c\udf89 BRAVO ! Vous avez trouv\u00e9 en {} tentative(s) !\", tentatives);\n                println!(\"\u2728 Le nombre \u00e9tait bien {} !\", nombre_secret);\n                break;\n            }\n        }\n        \n        \/\/ Indice suppl\u00e9mentaire apr\u00e8s quelques tentatives\n        if tentatives == 5 {\n            let parite = if nombre_secret % 2 == 0 { \"pair\" } else { \"impair\" };\n            println!(\"\ud83d\udca1 Indice : le nombre est {} !\", parite);\n        }\n    }\n    \n    println!(\"\\nMerci d'avoir jou\u00e9 ! \ud83d\udc4b\");\n}<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cargo build\ncargo run<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>cr\u00e9er le projet on obtient cela : dans le projet plus_moins Cargo.toml \/src\/main.rs<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-6011","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>projet plus_moins en RUST - workboot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"projet plus_moins en RUST - workboot\" \/>\n<meta property=\"og:description\" content=\"cr\u00e9er le projet on obtient cela : dans le projet plus_moins Cargo.toml \/src\/main.rs\" \/>\n<meta property=\"og:url\" content=\"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/\" \/>\n<meta property=\"og:site_name\" content=\"workboot\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-29T17:29:01+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/projet-plus_moins-en-rust\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/projet-plus_moins-en-rust\\\/\",\"name\":\"projet plus_moins en RUST - workboot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\"},\"datePublished\":\"2025-12-29T17:05:59+00:00\",\"dateModified\":\"2025-12-29T17:29:01+00:00\",\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/workboot.fr\\\/ciela\\\/projet-plus_moins-en-rust\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"name\":\"workboot\",\"description\":\"Open Source, Open Minds \",\"publisher\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\",\"name\":\"workboot\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"width\":1024,\"height\":950,\"caption\":\"workboot\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"projet plus_moins en RUST - workboot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/","og_locale":"fr_FR","og_type":"article","og_title":"projet plus_moins en RUST - workboot","og_description":"cr\u00e9er le projet on obtient cela : dans le projet plus_moins Cargo.toml \/src\/main.rs","og_url":"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/","og_site_name":"workboot","article_modified_time":"2025-12-29T17:29:01+00:00","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/","url":"https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/","name":"projet plus_moins en RUST - workboot","isPartOf":{"@id":"https:\/\/workboot.fr\/ciela\/#website"},"datePublished":"2025-12-29T17:05:59+00:00","dateModified":"2025-12-29T17:29:01+00:00","inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/workboot.fr\/ciela\/projet-plus_moins-en-rust\/"]}]},{"@type":"WebSite","@id":"https:\/\/workboot.fr\/ciela\/#website","url":"https:\/\/workboot.fr\/ciela\/","name":"workboot","description":"Open Source, Open Minds ","publisher":{"@id":"https:\/\/workboot.fr\/ciela\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/workboot.fr\/ciela\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/workboot.fr\/ciela\/#organization","name":"workboot","url":"https:\/\/workboot.fr\/ciela\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","width":1024,"height":950,"caption":"workboot"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"cr\u00e9er le projet on obtient cela : dans le projet plus_moins Cargo.toml \/src\/main.rs","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/6011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=6011"}],"version-history":[{"count":9,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/6011\/revisions"}],"predecessor-version":[{"id":6027,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/6011\/revisions\/6027"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=6011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}