Utilisation de _getch() pour lecture de caractère
Ajout de l'inclusion de la bibliothèque `<conio.h>` 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.
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
* Fait le 10/09/2024 <20> Nancy
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
|
||||
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<61>ment sur CTRL+ALT+SHIFT+ALTGR+... juste sur Echap en fait ;)\n\n");
|
||||
scanf_s("%c", &key);
|
||||
key = _getch();
|
||||
if (key == 27) {
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user