Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //Création du sous-programme permettant d'obtenir le menu
- int menu()
- {
- int choix = 4;
- //Blindage
- while (choix < 0 || choix > 3)
- {
- printf("Menu :\n");
- printf("1 : Nouvelle partie\n");
- printf("2 : Continuer\n");
- printf("3 : Voir les scores\n");
- printf("0 : Quitter\n");
- printf("Votre choix ? ");
- scanf("%d", &choix);
- }
- return choix;
- }
- //Programme principal utilisant le sous-programme
- int main()
- {
- switch (menu())
- {
- case 1:
- printf("Nouvelle partie !\n");
- break;
- case 2:
- printf("On continue !\n");
- break;
- case 3:
- printf("Voici les résultats\n");
- break;
- case 0:
- printf("Au revoir !\n");
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement