Vous êtes sur la page 1sur 4

#include <stddef.

h>
void adition()
{
srand(time(NULL));
int choix;
int nb1 = 0;
int nbmys = 0;
int nb2 = 0;
int score = 0;
int nbp = 0;
int nbpa = 0;
int reponse = 0;
int MIN, MAX;
printf("Quel difficulte ?\n1. Facile\n2. Moyen\n3. Dur\n||");
scanf("%d", &choix);
printf("Combien de manche veut tu faire ?\n||");
scanf("%d", &nbp);
score = nbp;
nbpa = nbp;
do
{
if(choix == 1)
{
MIN = 0;
MAX = 200;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 + nb2;
}
else if(choix == 2)
{
MIN = 50;
MAX = 750;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 + nb2;
}
else if(choix == 3)
{
MIN = 100;
MAX = 10000;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 + nb2;
}
printf("Combien font %d + %d ?\n||", nb1, nb2);
scanf("%d", &reponse);
if(reponse == nbmys)
{
printf("BONNE REPONSE !!!!\n");
}
else if(reponse!= nbmys)
{
printf("... Dommage c'est perdu. Cela faisait %d.\n", nbmys);
score = score - 1;
}
else
{
printf("ERROR 754\nLe jeu va s'arreter.");
}
nbpa = nbpa - 1;

}while(nbpa != 0);
printf("Ton score est de %d sur %d.", score, nbp);
}

void soustraction()
{
srand(time(NULL));
int choix;
int nb1 = 0;
int nbmys = 0;
int nb2 = 0;
int score = 0;
int nbp = 0;
int nbpa = 0;
int reponse = 0;
int MIN, MAX;
printf("Quel difficulte ?\n1. Facile\n2. Moyen\n3. Dur\n||");
scanf("%d", &choix);
printf("Combien de manche veut tu faire ?\n||");
scanf("%d", &nbp);
score = nbp;
nbpa = nbp;
do
{
if(choix == 1)
{
MIN = 0;
MAX = 200;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 - nb2;
}
else if(choix == 2)
{
MIN = 50;
MAX = 750;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 - nb2;
}
else if(choix == 3)
{
MIN = 100;
MAX = 10000;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 - nb2;
}
printf("Combien font %d - %d ?\n||", nb1, nb2);
scanf("%d", &reponse);
if(reponse == nbmys)
{
printf("BONNE REPONSE !!!!\n");
}
else if(reponse!= nbmys)
{
printf("... Dommage c'est perdu. Cela faisait %d.\n", nbmys);
score = score - 1;
}
else
{
printf("ERROR 754\nLe jeu va s'arreter.");
}
nbpa = nbpa - 1;

}while(nbpa != 0);
printf("Ton score est de %d sur %d.", score, nbp);

void multiplication()
{
srand(time(NULL));
int choix;
int nb1 = 0;
long nbmys = 0;
int nb2 = 0;
int score = 0;
long nbp = 0;
int nbpa = 0;
long reponse = 0;
int MIN, MAX;
printf("Quel difficulte ?\n1. Facile\n2. Moyen\n3. Dur\n||");
scanf("%d", &choix);
printf("Combien de manche veut tu faire ?\n||");
scanf("%d", &nbp);
score = nbp;
nbpa = nbp;
do
{
if(choix == 1)
{
MIN = 0;
MAX = 200;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 * nb2;
}
else if(choix == 2)
{
MIN = 50;
MAX = 750;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 * nb2;
}
else if(choix == 3)
{
MIN = 100;
MAX = 10000;
nb1 = (rand() % (MAX - MIN + 1)) + MIN;
nb2 = (rand() % (MAX - MIN + 1)) + MIN;
nbmys = nb1 * nb2;
}
printf("Combien font %d * %d ?\n||", nb1, nb2);
scanf("%d", &reponse);
if(reponse == nbmys)
{
printf("BONNE REPONSE !!!!\n");
}
else if(reponse!= nbmys)
{
printf("... Dommage c'est perdu. Cela faisait %d.\n", nbmys);
score = score - 1;
}
else
{
printf("ERROR 754\nLe jeu va s'arreter.");
}
nbpa = nbpa - 1;

}while(nbpa != 0);
printf("Ton score est de %d sur %d.", score, nbp);
}

Vous aimerez peut-être aussi