Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- int nb_joueurs()
- {
- int a;
- printf("Combien de joueurs ? (1 ou 2) : ");
- scanf("%d", &a);
- if(a!=1 && a!=2)
- {
- printf("\n !!! Erreur de saisie !!! \n\n");
- }
- return a;
- }
- void bornes(int * borne_inf, int * borne_sup)
- {
- printf("Borne inférieure : ");
- scanf("%d", borne_inf);
- printf("Borne supérieure : ");
- scanf("%d", borne_sup);
- while(*borne_inf == *borne_sup || *borne_inf < 0 || *borne_inf > *borne_sup)
- {
- printf("\n !!! Erreur de saisie !!! \n\n");
- bornes(borne_inf, borne_sup);
- }
- }
- void partie_1j(int joueurs, int borne_inf, int borne_sup)
- {
- printf("Vous avez sélectionné le mode %d joueur(s) \n", joueurs);
- printf("L'ordinateur a choisi un nombre aléatoire entre %d et %d \n", borne_inf, borne_sup);
- }
- int main()
- {
- int borne_inf;
- int borne_sup;
- int joueurs;
- joueurs = nb_joueurs();
- bornes(&borne_inf, &borne_sup);
- partie_1j(joueurs, borne_inf, borne_sup);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement