Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by Subnz ( 13 years ago )
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char *argv[]){
const int min = 1, max = 100;
srand(time(NULL));
int nombreMystere = (rand()0)+1;
int proposition = 0, nbCoups = 0, rejouer = 0;
do{
if(rejouer) {
nombreMystere = (rand()0)+1;
nbCoups = 0, rejouer = 0;
}
nbCoups++;
printf("Entrer votre proposition :\n");
scanf("%d",&proposition;);
if(proposition > nombreMystere){
printf("Trop grand\n");
} else if(proposition < nombreMystere) {
printf("Trop petit\n");
} else {
printf("C'est gagné en %d coups!!!\n",nbCoups);
do{
printf("Voulez-vous rejouer ? (Taper 0 pour non ou 1 pour oui)\n");
scanf("%d",&rejouer;);
}while(rejouer!=0 && rejouer!=1);
}
}while(proposition != nombreMystere || rejouer);
return 0;
}
Revise this Paste