From a9c9b2df56d313f2e6bc6f56371219d58e6679d3 Mon Sep 17 00:00:00 2001 From: Le Stagiaire Date: Tue, 24 Sep 2024 15:24:57 +0200 Subject: [PATCH] =?UTF-8?q?Utilisation=20de=20=5Fgetch()=20pour=20lecture?= =?UTF-8?q?=20de=20caract=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout de l'inclusion de la bibliothèque `` pour permettre l'utilisation de la fonction `_getch()`. Remplacement de `scanf_s("%c", &key);` par `key = _getch();` pour lire un caractère sans attendre la touche Entrée. --- CPP/Source1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CPP/Source1.cpp b/CPP/Source1.cpp index dbad1a1..296f37b 100644 --- a/CPP/Source1.cpp +++ b/CPP/Source1.cpp @@ -5,6 +5,7 @@ * Fait le 10/09/2024 à Nancy */ #include +#include using namespace std; @@ -22,7 +23,7 @@ int main(void) { } printf("Le nombre le plus grand est %d", a); printf("\n\nPour quitter, appuyez simultanément sur CTRL+ALT+SHIFT+ALTGR+... juste sur Echap en fait ;)\n\n"); - scanf_s("%c", &key); + key = _getch(); if (key == 27) { return 0; }