void fun(int start, int end){
int tmp = start+end;
string str;
cout << tmp/2;
cin >> str;
if (str == "correct"){ cout << "end of program\n";}
else{
if (str == "less"){ fun(tmp/2, end); }
else{ //bigger
fun(start, tmp/2);
}
}
}
#include
#include
void guess(int low, int high);
int main(){
Guess(1,1);
return 0;
}
void guess(int low, int high){
char str[5];
printf("%d right?\n",(low+high)/2);
scanf("高?低? %s",str);
if (!strcmp(str,"高"))
guess(low,(low+high)/2);
else if(!strcmp(str,"对")){
getc();
return;
}
else guess((low+high)/2,high);
}