Algorithme C+_C- { variable nbessai, ns, nad : entier Afficher("Cet algorithme vous propose de deviner un nombre entier choisi par moi entre 0 et 999 inclus. A vous de jouer.\n") nad <-- PartieEntiere(hasard()*1000) nbessai <-- 1 Afficher("Veuillez saisir votre choix") Saisir(ns) Tant que ((ns != nad) ET (nbessai != 10)) { Si (ns > nad) alors { Afficher("C'est moins.\n") } sinon { Afficher("C'est plus.\n") } Afficher("Veuillez saisir votre nouveau choix") Saisir(ns) nbessai <-- nbessai + 1 } // ATTENTION CE N'EST PAS BON CAR ON PEUT GAGNER AU 10ème ESSAI // Si (nbessai = 10) alors // { // Afficher("Perdu !!!!\n") // } // sinon // { // Afficher("Gagné !!!!\n") // } // Ceci est la BONNE solution Si (ns = nad) alors { Afficher("Gagné !!!!\n") } sinon { Afficher("Perdu !!!!\n") } }