Vincent38190

Jeu du pendu

Jan 20th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include "fonction.h"
  6. #include "dico.h"
  7. #include <time.h>
  8.  
  9. #define MOT_MYSTERE "PERSONNE"
  10. #define TAILLE_MAX 50
  11. #define NOMBRE_ESSAI 10
  12.  
  13. /*
  14.     fonction.h ---- http://pastebin.com/SnSRKpjb
  15.     fonction.c ---- http://pastebin.com/54w07xp9
  16.     dico.h ---- http://pastebin.com/qWkYuueE
  17.     dico.c ---- http://pastebin.com/0ZVtvV7x
  18.    
  19.     Dictionnaire des mots : http://pastebin.com/jjVMaAQJ
  20. */
  21.  
  22.  
  23.  
  24. int main()
  25. {
  26.     srand(time(NULL));
  27.     depart:
  28.     printf("Bienvenue dans le Pendu !\n\n");
  29.     char motMystere[TAILLE_MAX] = "", afficherPendu[TAILLE_MAX] = "",afficherFaute[20] = "";
  30.     Dictionnaire(motMystere);
  31.     CopierLeMotMystere(motMystere,afficherPendu);
  32.  
  33.     int test = 0,essaiRestant = NOMBRE_ESSAI;
  34.     do
  35.     {
  36.     if(essaiRestant <= 0)
  37.     {
  38.         printf("\n\n\nVous avez epuise votre nombre d'essai");
  39.         printf("\nLe mot mystere etait : %s\n\n\n",motMystere);
  40.         Pause();
  41.         goto fin;
  42.     }
  43.     else
  44.     {
  45.  
  46.  
  47.         printf("\nVous avez essaye les lettres : %s\nIl vous reste %d essai\n",afficherFaute,essaiRestant);
  48.         AfficherPendu(essaiRestant);
  49.         printf("\nMot secret : %s",afficherPendu);
  50.         printf("\nVotre proposition : ");
  51.         TestCaractere(motMystere,afficherPendu,&essaiRestant,&test,afficherFaute);
  52.  
  53.     }
  54.  
  55.  
  56.  
  57.  
  58.     }while(test == 0);
  59.     printf("\n\nBravo tu a trouve le mot mystere : %s\n\n",motMystere);
  60.     Pause();
  61.     goto fin;
  62.     return 0;
  63.  
  64.  
  65.     fin:
  66.         printf("\a\nVoulez vous recommencer ? (o/n)\n");
  67.         char retry = lireCaractere();
  68.             if(retry == 'O')
  69.                 goto depart;
  70.             else
  71.                 exit(0);
  72. }
Add Comment
Please, Sign In to add comment