Refactorisation de la boucle et ajout de commandes système
* 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`.
This commit is contained in:
@ -6,13 +6,15 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
char key;
|
|
||||||
do {
|
do {
|
||||||
|
system("cls");
|
||||||
|
system("color 0a");
|
||||||
printf("\t\t\tLe plus grand\n");
|
printf("\t\t\tLe plus grand\n");
|
||||||
printf("Entrez trois nombres entiers s<>par<61>s par des espaces : ");
|
printf("Entrez trois nombres entiers s<>par<61>s par des espaces : ");
|
||||||
scanf_s("%d %d %d", &a, &b, &c);
|
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("Le nombre le plus grand est %d", a);
|
||||||
printf("\n\nPour quitter, frappez la touche en haut <20> gauche de votre clavier ;)\n\n");
|
printf("\n\nPour quitter, frappez la touche en haut <20> gauche de votre clavier ;)\n\n");
|
||||||
key = _getch();
|
} while (_getch() != 27);
|
||||||
} while (key != 27);
|
return 0;
|
||||||
}
|
}
|
Reference in New Issue
Block a user