#include <stdio.h>
int main(void)
{
int head=0,count=-1,tail=100,cashe;
char dec;
printf("In order to prevent shamelessly, we must note the number you want.\n");
while(1)
{
printf("Plase input the number you want to(0<=count<100):");
scanf("%d",&count);
while(getchar()!='\n');
if(count<0||count>=100)
printf("You input is error!\n");
else
break;
}
while(1)
{
cashe=((head+tail)/2);
if(tail-1==head)
break;
while(1)
{
printf("Do you want numbers greater than %d?(Y\\N):",cashe);
dec=getchar();
while(getchar()!='\n');
if(dec=='y'||dec=='Y')
{
head=cashe;
break;
}
else if(dec=='n'||dec=='N')
{
tail=cashe;
break;
}
}
}
while(1)
{
printf("Do you think is %d?(Y\\N):",head);
dec=getchar();
while(getchar()!='\n');
if(dec=='y'||dec=='Y')
{
if(count==head)
{
printf("BYE BYE!You are an honest child!\n");
break;
}
else
{
printf("You really are not a good boy. I wish you to eat dog feces!\nBegone!\n");
break;
}
}
if(dec=='n'||dec=='N')
{
if(count!=head)
{
printf("Oh! My God, you see you are a careless child!\n");
break;
}
else
{
printf("You Go to hell, asshole. I wish you to eat dog feces!\n");
break;
}
}
}
}
int main(void)
{
int head=0,count=-1,tail=100,cashe;
char dec;
printf("In order to prevent shamelessly, we must note the number you want.\n");
while(1)
{
printf("Plase input the number you want to(0<=count<100):");
scanf("%d",&count);
while(getchar()!='\n');
if(count<0||count>=100)
printf("You input is error!\n");
else
break;
}
while(1)
{
cashe=((head+tail)/2);
if(tail-1==head)
break;
while(1)
{
printf("Do you want numbers greater than %d?(Y\\N):",cashe);
dec=getchar();
while(getchar()!='\n');
if(dec=='y'||dec=='Y')
{
head=cashe;
break;
}
else if(dec=='n'||dec=='N')
{
tail=cashe;
break;
}
}
}
while(1)
{
printf("Do you think is %d?(Y\\N):",head);
dec=getchar();
while(getchar()!='\n');
if(dec=='y'||dec=='Y')
{
if(count==head)
{
printf("BYE BYE!You are an honest child!\n");
break;
}
else
{
printf("You really are not a good boy. I wish you to eat dog feces!\nBegone!\n");
break;
}
}
if(dec=='n'||dec=='N')
{
if(count!=head)
{
printf("Oh! My God, you see you are a careless child!\n");
break;
}
else
{
printf("You Go to hell, asshole. I wish you to eat dog feces!\n");
break;
}
}
}
}
