From ea62c94a2add6c53b5a776189a3330c7f1dc4da0 Mon Sep 17 00:00:00 2001 From: Le Stagiaire Date: Tue, 24 Sep 2024 15:58:51 +0200 Subject: [PATCH] =?UTF-8?q?Refactorisation=20de=20la=20boucle=20et=20ajout?= =?UTF-8?q?=20de=20commandes=20syst=C3=A8me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Inclusion de `stdlib.h`. * Suppression de la variable `key`. * Ajout des appels à `system("cls")` et `system("color 0a")`. * Modification de la boucle `do-while` pour utiliser `_getch() != 27`. * Ajout de `return 0;` à la fin de `main`. --- CPP/Source1.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CPP/Source1.cpp b/CPP/Source1.cpp index f408e9a..21c7a2c 100644 --- a/CPP/Source1.cpp +++ b/CPP/Source1.cpp @@ -6,13 +6,15 @@ */ #include #include +#include using namespace std; int main(void) { int a, b, c; - char key; do { + system("cls"); + system("color 0a"); printf("\t\t\tLe plus grand\n"); printf("Entrez trois nombres entiers séparés par des espaces : "); scanf_s("%d %d %d", &a, &b, &c); @@ -24,6 +26,6 @@ int main(void) { } printf("Le nombre le plus grand est %d", a); printf("\n\nPour quitter, frappez la touche en haut à gauche de votre clavier ;)\n\n"); - key = _getch(); - } while (key != 27); + } while (_getch() != 27); + return 0; } \ No newline at end of file