Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int nb_joueurs()
  5. {
  6. int a;
  7. printf("Combien de joueurs ? (1 ou 2) : ");
  8. scanf("%d", &a);
  9.  
  10. if(a!=1 && a!=2)
  11. {
  12. printf("\n !!! Erreur de saisie !!! \n\n");
  13. }
  14.  
  15. return a;
  16. }
  17.  
  18. void bornes(int * borne_inf, int * borne_sup)
  19. {
  20. printf("Borne inférieure : ");
  21. scanf("%d", borne_inf);
  22. printf("Borne supérieure : ");
  23. scanf("%d", borne_sup);
  24.  
  25. while(*borne_inf == *borne_sup || *borne_inf < 0 || *borne_inf > *borne_sup)
  26. {
  27. printf("\n !!! Erreur de saisie !!! \n\n");
  28. bornes(borne_inf, borne_sup);
  29. }
  30. }
  31.  
  32. void partie_1j(int joueurs, int borne_inf, int borne_sup)
  33. {
  34. printf("Vous avez sélectionné le mode %d joueur(s) \n", joueurs);
  35. printf("L'ordinateur a choisi un nombre aléatoire entre %d et %d \n", borne_inf, borne_sup);
  36. }
  37.  
  38.  
  39.  
  40. int main()
  41. {
  42. int borne_inf;
  43. int borne_sup;
  44. int joueurs;
  45.  
  46. joueurs = nb_joueurs();
  47. bornes(&borne_inf, &borne_sup);
  48. partie_1j(joueurs, borne_inf, borne_sup);
  49.  
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement