45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
#include<stdio.h>
|
|
int main() {
|
|
char choix;
|
|
int nmax;
|
|
int ndevine;
|
|
int nprop;
|
|
while(1){
|
|
do{
|
|
printf("Bienvenue au Koikecélenombre !\n"
|
|
"1: très facile\n"
|
|
"2: facile\n"
|
|
"3: difficile\n"
|
|
"4: très difficile\n"
|
|
"5: expert\n"
|
|
"q: quitter l'application\n"
|
|
"Votre choix : ");
|
|
scanf("%c", &choix);
|
|
printf("\n");
|
|
if(choix=='q')return 0;
|
|
nmax=0;
|
|
if(choix=='1')nmax=10;
|
|
else if(choix=='2')nmax=20;
|
|
else if(choix=='3')nmax=50;
|
|
else if(choix=='4')nmax=100;
|
|
else if(choix=='5')nmax=500;
|
|
}while(nmax==0);
|
|
do{
|
|
printf("Ami, donnez votre nombre : ");
|
|
scanf("%d", &ndevine);
|
|
}while(nmax<ndevine || 1>ndevine);
|
|
|
|
//for(int i=0; i<420; i++){printf("\n");}
|
|
nprop=0;
|
|
printf("\033[2JMaintenant, joueur, faites vos propositions.\n");
|
|
for(int j=1; nprop!=ndevine; j++){
|
|
printf("Je pense que c'est le ");
|
|
scanf("%d", &nprop);
|
|
if(nprop<ndevine)printf("C'est plus.\n");
|
|
else if(ndevine<nprop)printf("C'est moins.\n");
|
|
else printf("C'est ça !\nFélicitations, tu as trouvé en %d propositions.\n",j);
|
|
}
|
|
|
|
}
|
|
}
|